home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / CATREPC.SQL < prev    next >
Encoding:
Text File  |  1995-05-09  |  135.3 KB  |  4,627 lines

  1. rem 
  2. rem $Header: catrepc.sql 7020200.1 95/02/15 18:32:17 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1993 by Oracle Corporation 
  5. Rem  ***** Oracle Proprietary                                           *****
  6. Rem  ***** This file contains the embodiment of proprietary technology. *****
  7. Rem  ***** It is for the sole use of Oracle employees and Oracle        *****
  8. Rem  ***** customers who have executed non-disclosure agreements.      *****
  9. Rem  ***** The contents of this file may not be disclosed to persons    *****
  10. Rem  ***** or organization who have not executed a non-disclosure      *****
  11. Rem  ***** agreement.                                                   *****
  12. Rem    NAME
  13. Rem      catrep.sql - replication catalog tables and views
  14. Rem    DESCRIPTION
  15. Rem      This file implements the repcat tables, views, and sequences.
  16. Rem      Tables:
  17. Rem         repcat$_repcat
  18. Rem         repcat$_repschema
  19. Rem         repcat$_repobject
  20. Rem         repcat$_key_columns
  21. Rem         repcat$_generated
  22. Rem         repcat$_repprop
  23. Rem         repcat$_repcatlog
  24. Rem         repcat$_ddl
  25. Rem       Sequences
  26. Rem         repcat_log_sequence
  27. Rem
  28. Rem      This following repcat tables are for conflict resolution 
  29. Rem      Tables:
  30. Rem         repcat$_audit_column
  31. Rem         repcat$_audit_attribute
  32. Rem         repcat$_parameter_column
  33. Rem         repcat$_resolution
  34. Rem         repcat$_resolution_method
  35. Rem         repcat$_conflict
  36. Rem         repcat$_grouped_column
  37. Rem         repcat$_column_group
  38. Rem         repcat$_priority
  39. Rem         repcat$_priority_group
  40. Rem         repcat$_statistics_control
  41. Rem         repcat$_statistics
  42. Rem
  43. Rem     The following views replace simpler views defined in catdefer.sql
  44. Rem     They reflect more repcat based deferred rpc destinations.
  45. Rem         defcalldest
  46. Rem         deftrandest
  47. Rem     The following package is created or replaced to make grants necessary
  48. Rem     to enable SYS to grant select in defcalldest.
  49. Rem         system.ora$_sys_rep_auth
  50. Rem
  51. Rem    NOTES
  52. Rem      Must be run when connected to SYS or INTERNAL
  53. Rem
  54. Rem    DEPENDENCIES
  55. Rem      
  56. Rem    USAGE
  57. Rem
  58. Rem    SECURITY
  59. Rem
  60. Rem    COMPATIBILITY
  61. Rem
  62. Rem    MODIFIED   (MM/DD/YY)
  63. Rem     hasun      01/23/95 -  merge changes from branch 1.1.710.9
  64. Rem     jstamos    01/20/95 -  add primary key and index
  65. Rem     adowning   12/21/94 -  merge changes from branch 1.1.710.6-8
  66. Rem     hasun      01/11/95 -  Add fix to resolve duplicate SCNs
  67. Rem     jstamos    12/08/94 -  foreign key in repschema to def$_destination
  68. Rem     dsdaniel   12/05/94 -  eliminate deftrandest
  69. Rem     adowning   12/05/94 -  fix all_repobject, all_repgenerated
  70. Rem     dsdaniel   11/17/94 -  merge changes from branch 1.1.710.5
  71. Rem     dsdaniel   11/11/94 -  defcalldest view
  72. Rem     dsdaniel   10/13/94 -  merge changes from branch 1.1.710.3
  73. Rem     jstamos    08/10/94 -  move trigger creation to prvtrepc.sql
  74. Rem     adowning   06/14/94 -  made tables owned by system
  75. Rem     ldoo       06/14/94 -  Creation of conflict resolution tables
  76. Rem     adowning   02/04/94 -  Branch_for_patch
  77. Rem     adowning   02/04/94 -  Creation
  78. Rem     adowning   02/04/94 -  Official creation
  79. Rem     jstamos    09/20/93 -  Creation
  80. Rem     jstamos    09/20/93 -  Unofficial creation
  81. Rem     ldoo       06/28/92 -  Added objects for collecting statistics.
  82.  
  83. --                               NOTE
  84. -- the procedure dbms_repcat_utl.canonicalize converts names to a common form
  85. -- the columns sname, oname, col, and rname_procedure in the following
  86. --   repcat tables are canonicalized
  87. -- each variable with the name canon_* must have been canonicalized
  88. -- each IN parameter with the name canon_* must be canonicalized
  89. --   unless specified otherwise, such a parameter must not be NULL
  90.  
  91. -- Sys is granted priviledges through roles, which don't apply to
  92. -- packages owned by sys.  Explicitly grant permissions.
  93. grant select any table to sys with admin option;
  94. grant insert any table to sys;
  95. grant update any table to sys;
  96. grant delete any table to sys;
  97. grant select any sequence to sys;
  98.  
  99. --  create a table for replicated schemas
  100. CREATE TABLE system.repcat$_repcat
  101. (
  102.   sname           VARCHAR2(30),  -- replicated schema name
  103.                     CONSTRAINT repcat$_repcat_primary PRIMARY KEY(sname),
  104.   master          VARCHAR2(1),   -- Y=master, N=snapshot
  105.   status          INTEGER        -- master: NORMAL, QUIESCING, or QUIESCED
  106.                                  -- snapshot: NULL
  107.                     CONSTRAINT repcat$_repcat_status
  108.                       CHECK (status IN (0, 1, 2)),
  109.   schema_comment  VARCHAR2(80)
  110. )
  111. /
  112. comment on table SYSTEM.REPCAT$_REPCAT is
  113. 'Information about all replicated schemas'
  114. /
  115. comment on column SYSTEM.REPCAT$_REPCAT.SNAME is
  116. 'Name of the replicated schema'
  117. /
  118. comment on column SYSTEM.REPCAT$_REPCAT.MASTER is
  119. 'Is the site a master site for the replicated schema'
  120. /
  121. comment on column SYSTEM.REPCAT$_REPCAT.STATUS is
  122. 'If the site is a master, the master''s status'
  123. /
  124. comment on column SYSTEM.REPCAT$_REPCAT.SCHEMA_COMMENT is
  125. 'Description of the replicated schema'
  126. /
  127.  
  128. CREATE OR REPLACE VIEW repcat_repcat
  129.   (sname, master, status, schema_comment) AS
  130.   SELECT
  131.     sname,
  132.     master,
  133.     DECODE (status,
  134.       0,    'NORMAL',
  135.       1,    'QUIESCING',
  136.       2,    'QUIESCED',
  137.       NULL, 'NORMAL',
  138.             'UNDEFINED'),
  139.     schema_comment
  140.   FROM system.repcat$_repcat
  141. /
  142. comment on table REPCAT_REPCAT is
  143. 'Information about all replicated schemas'
  144. /
  145. comment on column REPCAT_REPCAT.SNAME is
  146. 'Name of the replicated schema'
  147. /
  148. comment on column REPCAT_REPCAT.MASTER is
  149. 'Is the site a master site for the replicated schema'
  150. /
  151. comment on column REPCAT_REPCAT.STATUS is
  152. 'If the site is a master, the master''s status'
  153. /
  154. comment on column REPCAT_REPCAT.SCHEMA_COMMENT is
  155. 'Description of the replicated schema'
  156. /
  157.  
  158. -- create a table to hold the masters for replicated schemas
  159. -- if it is modified, modify the repcat_repschema view if appropriate
  160. CREATE TABLE system.repcat$_repschema
  161. (
  162.   sname           VARCHAR2(30),   -- replicated schema name
  163.                     CONSTRAINT repcat$_repschema_prnt FOREIGN KEY(sname)
  164.                       REFERENCES system.repcat$_repcat(sname)
  165.                       ON DELETE CASCADE,
  166.   dblink          VARCHAR2(128),  -- a master site (M_XDBI)
  167.                     CONSTRAINT repcat$_repschema_primary
  168.                       PRIMARY KEY(sname, dblink),
  169.                     CONSTRAINT repcat$_repschema_dest FOREIGN KEY(dblink)
  170.                       REFERENCES system.def$_destination(dblink),
  171.   masterdef       VARCHAR2(1),
  172.                     -- Y: the master has the authoritative definition
  173.                     -- N: the master has a copy
  174.   snapmaster      VARCHAR2(1),
  175.                     -- this col is maintained independently at each replica
  176.                     -- master: NULL
  177.                     -- snapshot: Y indicates current master for refreshing
  178.                     -- snapshot: N for all other masters
  179.   master_comment  VARCHAR2(80),
  180.   master          VARCHAR2(1),
  181.                     -- Y=master, N=snapshot
  182.                     -- this column duplicates repcat$_repcat.master
  183.                     -- it is here to improve deferred RPC performance
  184.   prop_updates    NUMBER DEFAULT 0,
  185.   my_dblink       VARCHAR2(1)
  186.                     -- Y = the dblink is my global_name
  187.                     -- N = ignore
  188.                     -- this column is here to detect a problem during import
  189. )
  190. /
  191. comment on table SYSTEM.REPCAT$_REPSCHEMA is
  192. 'N-way replication information'
  193. /
  194. comment on column SYSTEM.REPCAT$_REPSCHEMA.SNAME is
  195. 'Name of the replicated schema'
  196. /
  197. comment on column SYSTEM.REPCAT$_REPSCHEMA.DBLINK is
  198. 'A database site replicating the schema'
  199. /
  200. comment on column SYSTEM.REPCAT$_REPSCHEMA.MASTERDEF is
  201. 'Is the database the master definition site for the replicated schema'
  202. /
  203. comment on column SYSTEM.REPCAT$_REPSCHEMA.SNAPMASTER is
  204. 'For a snapshot site, is this the current refresh_master'
  205. /
  206. comment on column SYSTEM.REPCAT$_REPSCHEMA.MASTER_COMMENT is
  207. 'Description of the database site'
  208. /
  209. comment on column SYSTEM.REPCAT$_REPSCHEMA.MASTER is
  210. 'Redundant information from repcat$_repcat.master'
  211. /
  212. comment on column SYSTEM.REPCAT$_REPSCHEMA.PROP_UPDATES is
  213. 'Number of requested updates for master in repcat$_repprop'
  214. /
  215. comment on column SYSTEM.REPCAT$_REPSCHEMA.MY_DBLINK is
  216. 'A sanity check after import: is this master the current site'
  217. /
  218.  
  219. -- hide unnormalized, duplicate data (master column) from users
  220. CREATE OR REPLACE VIEW repcat_repschema AS
  221.   SELECT sname, dblink, masterdef, snapmaster, master_comment
  222.   FROM system.repcat$_repschema
  223. /
  224. comment on table REPCAT_REPSCHEMA is
  225. 'N-way replication information'
  226. /
  227. comment on column REPCAT_REPSCHEMA.SNAME is
  228. 'Name of the replicated schema'
  229. /
  230. comment on column REPCAT_REPSCHEMA.DBLINK is
  231. 'A database site replicating the schema'
  232. /
  233. comment on column REPCAT_REPSCHEMA.MASTERDEF is
  234. 'Is the database the master definition site for the replicated schema'
  235. /
  236. comment on column REPCAT_REPSCHEMA.SNAPMASTER is
  237. 'For a snapshot site, is this the current refresh_master'
  238. /
  239. comment on column REPCAT_REPSCHEMA.MASTER_COMMENT is
  240. 'Description of the database site'
  241. /
  242.  
  243. -- create a table that names the replicated objects
  244. CREATE TABLE system.repcat$_repobject
  245. (
  246.   sname           VARCHAR2(30),  -- replicated schema name
  247.                     CONSTRAINT repcat$_repobject_prnt FOREIGN KEY(sname)
  248.                       REFERENCES system.repcat$_repcat(sname)
  249.                       ON DELETE CASCADE,
  250.   oname           VARCHAR2(30),  -- replicated object name,
  251.   type            INTEGER
  252.                     CONSTRAINT repcat$_repobject_type
  253.                       CHECK (type IN (-1, 1, 2, 4, 5, 7, 8, 9, 11, 12)),
  254.                     CONSTRAINT repcat$_repobject_primary
  255.                       PRIMARY KEY(sname, oname, type),
  256.   id              NUMBER,
  257.   object_comment  VARCHAR2(80),
  258.   status          INTEGER
  259.                     -- this col is maintained independently at each replica
  260.                     CONSTRAINT repcat$_repobject_status
  261.                       CHECK (status IN (0, 1, 2, 3, 4))
  262. )
  263. /
  264. comment on table SYSTEM.REPCAT$_REPOBJECT is
  265. 'Information about replicated objects'
  266. /
  267. comment on column SYSTEM.REPCAT$_REPOBJECT.SNAME is
  268. 'Name of the object owner'
  269. /
  270. comment on column SYSTEM.REPCAT$_REPOBJECT.ONAME is
  271. 'Name of the object'
  272. /
  273. comment on column SYSTEM.REPCAT$_REPOBJECT.TYPE is
  274. 'Type of the object'
  275. /
  276. comment on column SYSTEM.REPCAT$_REPOBJECT.STATUS is
  277. 'Status of the last create or alter request on the local object'
  278. /
  279. comment on column SYSTEM.REPCAT$_REPOBJECT.ID is
  280. 'Identifier of the local object'
  281. /
  282. comment on column SYSTEM.REPCAT$_REPOBJECT.OBJECT_COMMENT is
  283. 'Description of the replicated object'
  284. /
  285.  
  286. CREATE OR REPLACE VIEW repcat_repobject
  287.   (sname, oname, type, status, id, object_comment) AS
  288.   SELECT
  289.     sname,
  290.     oname,
  291.     DECODE (type,
  292.       -1, 'SNAPSHOT',
  293.        1, 'INDEX',
  294.        2, 'TABLE',
  295.        4, 'VIEW',
  296.        5, 'SYNONYM',
  297.        6, 'SEQUENCE',
  298.        7, 'PROCEDURE',
  299.        8, 'FUNCTION',
  300.        9, 'PACKAGE',
  301.       11, 'PACKAGE BODY',
  302.       12, 'TRIGGER',
  303.           'UNDEFINED'),
  304.     DECODE (status,
  305.       0, 'CREATE',
  306.       1, 'COMPARE',
  307.       2, 'VALID',
  308.       3, 'DROPPED',
  309.       4, 'ERROR',
  310.          'UNDEFINED'),
  311.     id,
  312.     object_comment
  313.   FROM system.repcat$_repobject
  314. /
  315. comment on table REPCAT_REPOBJECT is
  316. 'Information about replicated objects'
  317. /
  318. comment on column REPCAT_REPOBJECT.SNAME is
  319. 'Name of the object owner'
  320. /
  321. comment on column REPCAT_REPOBJECT.ONAME is
  322. 'Name of the object'
  323. /
  324. comment on column REPCAT_REPOBJECT.TYPE is
  325. 'Type of the object'
  326. /
  327. comment on column REPCAT_REPOBJECT.STATUS is
  328. 'Status of the last create or alter request on the local object'
  329. /
  330. comment on column REPCAT_REPOBJECT.ID is
  331. 'Identifier of the local object'
  332. /
  333. comment on column REPCAT_REPOBJECT.OBJECT_COMMENT is
  334. 'Description of the replicated object'
  335. /
  336.  
  337. -- create a table that names "primary-key" columns for column-level repl
  338. CREATE TABLE system.repcat$_key_columns
  339. (
  340.   sname  VARCHAR2(30),  -- replicated schema name
  341.   oname  VARCHAR2(30),  -- replicated object name
  342.   type   INTEGER,
  343.            CONSTRAINT repcat$_key_columns_prnt
  344.              FOREIGN KEY(sname, oname, type)
  345.              REFERENCES system.repcat$_repobject(sname, oname, type)
  346.              ON DELETE CASCADE,
  347.   col    VARCHAR2(30),
  348.            CONSTRAINT repcat$_key_columns_primary
  349.              PRIMARY KEY(sname, oname, col)
  350. )
  351. /
  352. comment on table SYSTEM.REPCAT$_KEY_COLUMNS is
  353. 'Primary columns for a table using column-level replication'
  354. /
  355. comment on column SYSTEM.REPCAT$_KEY_COLUMNS.SNAME is
  356. 'Schema containing table'
  357. /
  358. comment on column SYSTEM.REPCAT$_KEY_COLUMNS.ONAME is
  359. 'Name of the table'
  360. /
  361. comment on column SYSTEM.REPCAT$_KEY_COLUMNS.TYPE is
  362. 'Type identifier'
  363. /
  364. comment on column SYSTEM.REPCAT$_KEY_COLUMNS.COL is
  365. 'Column in the table'
  366. /
  367.  
  368. -- track the objects generated to support row/column-level replication
  369. -- as well as wrappers generated to support procedural replication
  370. CREATE TABLE system.repcat$_generated
  371. (
  372.   sname              VARCHAR2(30),  -- schema of generated object
  373.   oname              VARCHAR2(30),  -- name of generated object
  374.   type               INTEGER,        -- type of generated object
  375.                        CONSTRAINT repcat$_repgen_primary
  376.                          PRIMARY KEY(sname, oname, type),
  377.                        CONSTRAINT repcat$_repgen_prnt
  378.                          FOREIGN KEY(sname, oname, type)
  379.                          REFERENCES system.repcat$_repobject(sname, oname,
  380.                                                              type)
  381.                          ON DELETE CASCADE,
  382.   reason              NUMBER,
  383.                        CONSTRAINT repcat$_generated_obj
  384.                          CHECK (reason IN (0, 1, 2, 3, 4, 5)),
  385.                          -- 0 = trigger 
  386.                          -- 1 = replication package 
  387.                          -- 2 = resolution package 
  388.                          -- 3 = priority package
  389.                          -- 4 = auditing package
  390.                          -- 5 = procedural replication wrapper
  391.   base_sname         VARCHAR2(30),  -- schema of user's object
  392.   base_oname         VARCHAR2(30),  -- name of user's object
  393.   base_type          INTEGER,        -- type of user's object
  394.                        CONSTRAINT repcat$_repgen_prnt2
  395.                          FOREIGN KEY(base_sname, base_oname, base_type)
  396.                          REFERENCES system.repcat$_repobject(sname, oname,
  397.                                                              type)
  398.                          ON DELETE CASCADE,
  399.   package_prefix    VARCHAR2(30),   -- for package wrappers
  400.   procedure_prefix  VARCHAR2(30),   -- for procedure and package wrappers
  401.                     -- universal code will have two 'Y's below
  402.   distributed       VARCHAR2(1)     -- 'Y' or 'N'
  403. )
  404. /
  405. comment on table SYSTEM.REPCAT$_GENERATED is
  406. 'Objects generated to support replication'
  407. /
  408. comment on column SYSTEM.REPCAT$_GENERATED.SNAME is
  409. 'Schema containing the generated object'
  410. /
  411. comment on column SYSTEM.REPCAT$_GENERATED.ONAME is
  412. 'Name of the generated object'
  413. /
  414. comment on column SYSTEM.REPCAT$_GENERATED.TYPE is
  415. 'Type of the generated object'
  416. /
  417. comment on column SYSTEM.REPCAT$_GENERATED.BASE_SNAME is
  418. 'Name of the object''s owner'
  419. /
  420. comment on column SYSTEM.REPCAT$_GENERATED.BASE_ONAME is
  421. 'Name of the object'
  422. /
  423. comment on column SYSTEM.REPCAT$_GENERATED.BASE_TYPE is
  424. 'Type of the object'
  425. /
  426. comment on column SYSTEM.REPCAT$_GENERATED.REASON is
  427. 'Reason the object was generated'
  428. /
  429. comment on column SYSTEM.REPCAT$_GENERATED.PACKAGE_PREFIX is
  430. 'Prefix for package wrapper'
  431. /
  432. comment on column SYSTEM.REPCAT$_GENERATED.PROCEDURE_PREFIX is
  433. 'Procedure prefix for package wrapper or procedure wrapper'
  434. /
  435. comment on column SYSTEM.REPCAT$_GENERATED.DISTRIBUTED is
  436. 'Is the generated object separately generated at each master'
  437. /
  438.  
  439. CREATE INDEX system.repcat$_generated_n1 ON
  440.   system.repcat$_generated(base_sname, base_oname, base_type)
  441. /
  442.  
  443. CREATE OR REPLACE VIEW repcat_generated
  444.   (sname, oname, type, reason, base_sname, base_oname, base_type, 
  445.     package_prefix, procedure_prefix, distributed) AS
  446.   SELECT
  447.     sname,
  448.     oname,
  449.     DECODE (type,
  450.       -1, 'SNAPSHOT',
  451.        1, 'INDEX',
  452.        2, 'TABLE',
  453.        4, 'VIEW',
  454.        5, 'SYNONYM',
  455.        6, 'SEQUENCE',
  456.        7, 'PROCEDURE',
  457.        8, 'FUNCTION',
  458.        9, 'PACKAGE',
  459.       11, 'PACKAGE BODY',
  460.       12, 'TRIGGER',
  461.           'UNDEFINED'),
  462.     DECODE (reason,
  463.        0, 'REPLICATION TRIGGER',
  464.        1, 'REPLICATION PACKAGE',
  465.        2, 'RESOLUTION PACKAGE',
  466.        3, 'PRIORITY PACKAGE',
  467.        4, 'AUDIT PACKAGE',
  468.        5, 'PROCEDURAL REPLICATION WRAPPER',
  469.           'UNDEFINED'),
  470.     base_sname,
  471.     base_oname,
  472.     DECODE (base_type,
  473.       -1, 'SNAPSHOT',
  474.        1, 'INDEX',
  475.        2, 'TABLE',
  476.        4, 'VIEW',
  477.        5, 'SYNONYM',
  478.        6, 'SEQUENCE',
  479.        7, 'PROCEDURE',
  480.        8, 'FUNCTION',
  481.        9, 'PACKAGE',
  482.       11, 'PACKAGE BODY',
  483.       12, 'TRIGGER',
  484.           'UNDEFINED'),
  485.     package_prefix,
  486.     procedure_prefix,
  487.     distributed
  488.   FROM system.repcat$_generated
  489. /
  490. comment on table REPCAT_GENERATED is
  491. 'Objects generated to support replication'
  492. /
  493. comment on column REPCAT_GENERATED.SNAME is
  494. 'Schema containing the generated object'
  495. /
  496. comment on column REPCAT_GENERATED.ONAME is
  497. 'Name of the generated object'
  498. /
  499. comment on column REPCAT_GENERATED.TYPE is
  500. 'Type of the generated object'
  501. /
  502. comment on column REPCAT_GENERATED.BASE_SNAME is
  503. 'Name of the object''s owner'
  504. /
  505. comment on column REPCAT_GENERATED.BASE_ONAME is
  506. 'Name of the object'
  507. /
  508. comment on column REPCAT_GENERATED.BASE_TYPE is
  509. 'Type of the object'
  510. /
  511. comment on column REPCAT_GENERATED.PACKAGE_PREFIX is
  512. 'Prefix for package wrapper'
  513. /
  514. comment on column REPCAT_GENERATED.PROCEDURE_PREFIX is
  515. 'Procedure prefix for package wrapper or procedure wrapper'
  516. /
  517. comment on column REPCAT_GENERATED.DISTRIBUTED is
  518. 'Is the generated object separately generated at each master'
  519. /
  520.  
  521. -- create a table to hold propagation information
  522. -- (row-level and column-level replication of tables)
  523. -- (procedure wrappers)
  524. CREATE TABLE system.repcat$_repprop
  525. (
  526.   sname              VARCHAR2(30),  -- replicated schema name
  527.   oname              VARCHAR2(30),  -- replicated object name
  528.   type               INTEGER,
  529.                        CONSTRAINT repcat$_repprop_prnt
  530.                          FOREIGN KEY(sname, oname, type)
  531.                          REFERENCES system.repcat$_repobject(sname, oname,
  532.                                                              type)
  533.                          ON DELETE CASCADE,
  534.   dblink             VARCHAR2(128),  -- a master site (M_XDBI)
  535.                        CONSTRAINT repcat$_repprop_primary
  536.                          PRIMARY KEY(sname, oname, type, dblink),
  537.                        CONSTRAINT repcat$_repprop_prnt2
  538.                          FOREIGN KEY(sname, dblink)
  539.                          REFERENCES system.repcat$_repschema(sname, dblink)
  540.                          ON DELETE CASCADE,
  541.   how                INTEGER
  542.                        CONSTRAINT repcat$_repprop_how
  543.                          CHECK (how IN (0, 1, 2, 3)),
  544.   propagate_comment  VARCHAR2(80)
  545. )
  546. /
  547. comment on table SYSTEM.REPCAT$_REPPROP is
  548. 'Propagation information about replicated objects'
  549. /
  550. comment on column SYSTEM.REPCAT$_REPPROP.SNAME is
  551. 'Name of the object owner'
  552. /
  553. comment on column SYSTEM.REPCAT$_REPPROP.ONAME is
  554. 'Name of the object'
  555. /
  556. comment on column SYSTEM.REPCAT$_REPPROP.TYPE is
  557. 'Type of the object'
  558. /
  559. comment on column SYSTEM.REPCAT$_REPPROP.DBLINK is
  560. 'Destination database for propagation'
  561. /
  562. comment on column SYSTEM.REPCAT$_REPPROP.HOW is
  563. 'Propagation choice for the destination database'
  564. /
  565. comment on column SYSTEM.REPCAT$_REPPROP.PROPAGATE_COMMENT is
  566. 'Description of the propagation choice'
  567. /
  568.  
  569. CREATE OR REPLACE VIEW repcat_repprop
  570.   (sname, oname, type, dblink, how, propagate_comment)
  571.   AS SELECT
  572.     p.sname,
  573.     p.oname,
  574.     DECODE (p.type,
  575.       -1, 'SNAPSHOT',
  576.        1, 'INDEX',
  577.        2, 'TABLE',
  578.        4, 'VIEW',
  579.        5, 'SYNONYM',
  580.        6, 'SEQUENCE',
  581.        7, 'PROCEDURE',
  582.        8, 'FUNCTION',
  583.        9, 'PACKAGE',
  584.       11, 'PACKAGE BODY',
  585.       12, 'TRIGGER',
  586.           'UNDEFINED'),
  587.     p.dblink,
  588.     DECODE (p.how,
  589.       0, 'NONE',
  590.       1, 'ASYNCHRONOUS',
  591.       2, 'SYNCHRONOUS',
  592.       3, 'SYNC_OR_ASYNC',
  593.          'UNDEFINED'),
  594.     p.propagate_comment
  595.   FROM system.repcat$_repprop p
  596.   WHERE (p.sname, p.oname, p.type)
  597.     NOT IN (SELECT sname, oname, type from system.repcat$_generated)
  598.     AND p.oname != 'REP$WHAT_AM_I'
  599. /
  600. comment on table REPCAT_REPPROP is
  601. 'Propagation information about replicated objects'
  602. /
  603. comment on column REPCAT_REPPROP.SNAME is
  604. 'Name of the object owner'
  605. /
  606. comment on column REPCAT_REPPROP.ONAME is
  607. 'Name of the object'
  608. /
  609. comment on column REPCAT_REPPROP.TYPE is
  610. 'Type of the object'
  611. /
  612. comment on column REPCAT_REPPROP.DBLINK is
  613. 'Destination database for propagation'
  614. /
  615. comment on column REPCAT_REPPROP.HOW is
  616. 'Propagation choice for the destination database'
  617. /
  618. comment on column REPCAT_REPPROP.PROPAGATE_COMMENT is
  619. 'Description of the propagation choice'
  620. /
  621.  
  622. -- create a table to hold the repcat intentions list and asynchronous errors
  623. CREATE TABLE system.repcat$_repcatlog
  624. (
  625.   version       NUMBER,           -- repcat version number
  626.   id            NUMBER,           -- sequence number
  627.   source        VARCHAR2(128),    -- where the request originated
  628.   userid        VARCHAR2(30),     -- who made the request
  629.   timestamp     DATE,             -- when the request was made
  630.   role          VARCHAR2(1),      -- 'Y' for masterdef and 'N' for master
  631.   master        VARCHAR2(128),    -- which master executes this intention
  632.                   CONSTRAINT repcat$_repcatlog_primary
  633.                     PRIMARY KEY(id, source, role, master),
  634.   sname         VARCHAR2(30),     -- replicated schema name
  635.   request       INTEGER,          -- repcat administrative procedure name
  636.                   CONSTRAINT repcat$_repcatlog_request
  637.                     CHECK (request IN (-1, 0, 1, 2, 3, 4, 5, 6, 7, 8)),
  638.   oname         VARCHAR2(30),     -- replicated object name, if applicable
  639.   type          INTEGER,          -- replicated object type, if applicable
  640.                   CONSTRAINT repcat$_repcatlog_type
  641.                     CHECK (type IN (-1, 0, 1, 2, 4, 5, 7, 8, 9, 11, 12)),
  642.   a_comment     VARCHAR2(80),     -- replicated comment, if applicable
  643.   bool_arg      VARCHAR2(1),      -- boolean argument, if applicable
  644.   ano_bool_arg  VARCHAR2(1),      -- another boolean argument, if applicable
  645.   int_arg       INTEGER,          -- integer argument, if applicable
  646.   ano_int_arg   INTEGER,          -- another integer argument, if applicable
  647.   lines         INTEGER,          -- number of lines in repcat$_ddl
  648.   status        INTEGER
  649.                   CONSTRAINT repcat$_repcatlog_status
  650.                     CHECK (status IN (0, 1, 2, 3)),
  651.   message       VARCHAR2(200),    -- error message
  652.   errnum        NUMBER            -- Oracle error number
  653. )
  654. /
  655. comment on table SYSTEM.REPCAT$_REPCATLOG is
  656. 'Information about asynchronous administration requests'
  657. /
  658. comment on column SYSTEM.REPCAT$_REPCATLOG.VERSION is
  659. 'Version of the repcat log record'
  660. /
  661. comment on column SYSTEM.REPCAT$_REPCATLOG.ID is
  662. 'Identifying number of repcat log record'
  663. /
  664. comment on column SYSTEM.REPCAT$_REPCATLOG.SOURCE is
  665. 'Name of the database at which the request originated'
  666. /
  667. comment on column SYSTEM.REPCAT$_REPCATLOG.USERID is
  668. 'Name of the user who submitted the request'
  669. /
  670. comment on column SYSTEM.REPCAT$_REPCATLOG.TIMESTAMP is
  671. 'When the request was submitted'
  672. /
  673. comment on column SYSTEM.REPCAT$_REPCATLOG.ROLE is
  674. 'Is this database the masterdef for the request'
  675. /
  676. comment on column SYSTEM.REPCAT$_REPCATLOG.MASTER is
  677. 'Name of the database that processes this request$_ddl'
  678. /
  679. comment on column SYSTEM.REPCAT$_REPCATLOG.SNAME is
  680. 'Name of the replicated schema'
  681. /
  682. comment on column SYSTEM.REPCAT$_REPCATLOG.REQUEST is
  683. 'Name of the requested operation'
  684. /
  685. comment on column SYSTEM.REPCAT$_REPCATLOG.ONAME is
  686. 'Replicated object name, if applicable'
  687. /
  688. comment on column SYSTEM.REPCAT$_REPCATLOG.TYPE is
  689. 'Type of replicated object, if applicable'
  690. /
  691. comment on column SYSTEM.REPCAT$_REPCATLOG.A_COMMENT is
  692. 'Textual argument used for comments'
  693. /
  694. comment on column SYSTEM.REPCAT$_REPCATLOG.BOOL_ARG is
  695. 'Boolean argument'
  696. /
  697. comment on column SYSTEM.REPCAT$_REPCATLOG.ANO_BOOL_ARG is
  698. 'Another Boolean argument'
  699. /
  700. comment on column SYSTEM.REPCAT$_REPCATLOG.INT_ARG is
  701. 'Integer argument'
  702. /
  703. comment on column SYSTEM.REPCAT$_REPCATLOG.ANO_INT_ARG is
  704. 'Another integer argument'
  705. /
  706. comment on column SYSTEM.REPCAT$_REPCATLOG.LINES is
  707. 'The number of rows in system.repcat$_ddl at the processing site'
  708. /
  709. comment on column SYSTEM.REPCAT$_REPCATLOG.STATUS is
  710. 'Status of the request at this database'
  711. /
  712. comment on column SYSTEM.REPCAT$_REPCATLOG.MESSAGE is
  713. 'Error message associated with processing the request'
  714. /
  715. comment on column SYSTEM.REPCAT$_REPCATLOG.ERRNUM is
  716. 'Oracle error number associated with processing the request'
  717. /
  718.  
  719. -- hide arguments and encodings from users
  720. CREATE OR REPLACE VIEW repcat_repcatlog
  721.   (id, source, status, userid, timestamp, role, master, sname, request, oname,
  722.     type, message, errnum)
  723.   AS SELECT
  724.     id,
  725.     source,
  726.     DECODE(status,
  727.       0, 'READY',
  728.       1, 'DO_CALLBACK',
  729.       2, 'AWAIT_CALLBACK',
  730.       3, 'ERROR',
  731.          'UNDEFINED'),
  732.     userid,
  733.     timestamp,
  734.     DECODE (role,
  735.       'Y', 'MASTERDEF',
  736.       'N', 'MASTER',
  737.            'UNDEFINED'),
  738.     master,
  739.     sname,
  740.     DECODE(request,
  741.       -1, '*** TESTING ***',
  742.        0, 'CREATE_MASTER_REPOBJECT',
  743.        1, 'DROP_MASTER_REPSCHEMA',
  744.        2, 'ADD_MASTER_DATABASE',
  745.        3, 'ALTER_MASTER_REPOBJECT',
  746.        4, 'DROP_MASTER_REPOBJECT',
  747.        5, 'SUSPEND_MASTER_ACTIVITY',
  748.        6, 'RESUME_MASTER_ACTIVITY',
  749.        7, 'EXECUTE_DDL',
  750.        8, 'GENERATE_REPLICATION_SUPPORT',
  751.           'UNDEFINED'),
  752.     oname,
  753.     DECODE (type,
  754.       -1, 'SNAPSHOT',
  755.        0, 'UNDEFINED',
  756.        1, 'INDEX',
  757.        2, 'TABLE',
  758.        4, 'VIEW',
  759.        5, 'SYNONYM',
  760.        6, 'SEQUENCE',
  761.        7, 'PROCEDURE',
  762.        8, 'FUNCTION',
  763.        9, 'PACKAGE',
  764.       11, 'PACKAGE BODY',
  765.       12, 'TRIGGER',
  766.           'UNDEFINED'),
  767.     message,
  768.     errnum
  769.   FROM system.repcat$_repcatlog
  770. /
  771. comment on table REPCAT_REPCATLOG is
  772. 'Information about asynchronous administration requests'
  773. /
  774. comment on column REPCAT_REPCATLOG.ID is
  775. 'Identifying number of repcat log record'
  776. /
  777. comment on column REPCAT_REPCATLOG.SOURCE is
  778. 'Name of the database at which the request originated'
  779. /
  780. comment on column REPCAT_REPCATLOG.STATUS is
  781. 'Status of the request at this database'
  782. /
  783. comment on column REPCAT_REPCATLOG.USERID is
  784. 'Name of the user who submitted the request'
  785. /
  786. comment on column REPCAT_REPCATLOG.TIMESTAMP is
  787. 'When the request was submitted'
  788. /
  789. comment on column REPCAT_REPCATLOG.ROLE is
  790. 'Is this database the masterdef for the request'
  791. /
  792. comment on column REPCAT_REPCATLOG.MASTER is
  793. 'Name of the database that processes this request'
  794. /
  795. comment on column REPCAT_REPCATLOG.SNAME is
  796. 'Name of the replicated schema'
  797. /
  798. comment on column REPCAT_REPCATLOG.REQUEST is
  799. 'Name of the requested operation'
  800. /
  801. comment on column REPCAT_REPCATLOG.ONAME is
  802. 'Replicated object name, if applicable'
  803. /
  804. comment on column REPCAT_REPCATLOG.TYPE is
  805. 'Type of replicated object, if applicable'
  806. /
  807. comment on column REPCAT_REPCATLOG.MESSAGE is
  808. 'Error message associated with processing the request'
  809. /
  810. comment on column REPCAT_REPCATLOG.ERRNUM is
  811. 'Oracle error number associated with processing the request'
  812. /
  813.  
  814. -- create a table that holds ddl
  815. CREATE TABLE system.repcat$_ddl
  816. (
  817.   log_id  NUMBER,                 -- request identifier
  818.   source  VARCHAR2(128),          -- where the request originated
  819.   role    VARCHAR2(1),            -- 'Y' for masterdef and 'N' for master
  820.   master  VARCHAR2(128),          -- 
  821.             CONSTRAINT repcat$_ddl_prnt
  822.               FOREIGN KEY(log_id, source, role, master)
  823.               REFERENCES system.repcat$_repcatlog(id, source, role, master)
  824.               ON DELETE CASCADE,
  825.   line    INTEGER,
  826.   text    VARCHAR2(2000)          -- ddl to execute
  827. )
  828. /
  829. comment on table SYSTEM.REPCAT$_DDL is
  830. 'Arguments that do not fit in a single repcat log record'
  831. /
  832. comment on column SYSTEM.REPCAT$_DDL.LOG_ID is
  833. 'Identifying number of the repcat log record'
  834. /
  835. comment on column SYSTEM.REPCAT$_DDL.SOURCE is
  836. 'Name of the database at which the request originated'
  837. /
  838. comment on column SYSTEM.REPCAT$_DDL.ROLE is
  839. 'Is this database the masterdef for the request'
  840. /
  841. comment on column SYSTEM.REPCAT$_DDL.MASTER is
  842. 'Name of the database that processes this request'
  843. /
  844. comment on column SYSTEM.REPCAT$_DDL.LINE is
  845. 'Ordering of records within a single request'
  846. /
  847. comment on column SYSTEM.REPCAT$_DDL.TEXT is
  848. 'Portion of an argument'
  849. /
  850.  
  851. CREATE UNIQUE INDEX system.repcat$_ddl ON
  852.   system.repcat$_ddl(log_id, source, role, master, line)
  853. /
  854.  
  855. CREATE SEQUENCE system.repcat_log_sequence;
  856. /
  857.  
  858. create or replace view USER_REPCAT
  859.   (SNAME, MASTER, STATUS, SCHEMA_COMMENT)
  860. as
  861. select r.sname, r.master, r.status, r.schema_comment
  862. from repcat_repcat r, user_users u
  863. where r.sname = u.username
  864. /
  865. comment on table USER_REPCAT is
  866. 'Replication information about the current user'
  867. /
  868. comment on column USER_REPCAT.SNAME is
  869. 'Name of the user'
  870. /
  871. comment on column USER_REPCAT.MASTER is
  872. 'Is the site a master site'
  873. /
  874. comment on column USER_REPCAT.STATUS is
  875. 'If site is master, the master''s status'
  876. /
  877. comment on column USER_REPCAT.SCHEMA_COMMENT is
  878. 'User description of the replicated schema'
  879. /
  880. drop public synonym USER_REPCAT
  881. /
  882. create public synonym USER_REPCAT for USER_REPCAT
  883. /
  884. grant select on USER_REPCAT to PUBLIC with grant option
  885. /
  886. create or replace view ALL_REPCAT
  887.     (SNAME, MASTER, STATUS, SCHEMA_COMMENT)
  888. as
  889. select r.sname, r.master, r.status, r.schema_comment
  890. from repcat_repcat r, all_users u
  891. where r.sname = u.username
  892. /
  893. comment on table ALL_REPCAT is
  894. 'Information about replicated schemas'
  895. /
  896. comment on column ALL_REPCAT.SNAME is
  897. 'Name of the replicated schema'
  898. /
  899. comment on column ALL_REPCAT.MASTER is
  900. 'Is the site a master site for the replicated schema'
  901. /
  902. comment on column ALL_REPCAT.STATUS is
  903. 'If the site is a master, the master''s status'
  904. /
  905. comment on column ALL_REPCAT.SCHEMA_COMMENT is
  906. 'Description of the replicated schema'
  907. /
  908. drop public synonym ALL_REPCAT
  909. /
  910. create public synonym ALL_REPCAT for ALL_REPCAT
  911. /
  912. grant select on ALL_REPCAT to PUBLIC with grant option
  913. /
  914. create or replace view DBA_REPCAT
  915.     (SNAME, MASTER, STATUS, SCHEMA_COMMENT)
  916. as
  917. select r.sname, r.master, r.status, r.schema_comment
  918. from repcat_repcat r
  919. /
  920. comment on table DBA_REPCAT is
  921. 'Information about all replicated schemas'
  922. /
  923. comment on column DBA_REPCAT.SNAME is
  924. 'Name of the replicated schema'
  925. /
  926. comment on column DBA_REPCAT.MASTER is
  927. 'Is the site a master site for the replicated schema'
  928. /
  929. comment on column DBA_REPCAT.STATUS is
  930. 'If the site is a master, the master''s status'
  931. /
  932. comment on column DBA_REPCAT.SCHEMA_COMMENT is
  933. 'Description of the replicated schema'
  934. /
  935. create or replace view USER_REPSCHEMA
  936.     (SNAME, DBLINK, MASTERDEF, SNAPMASTER, MASTER_COMMENT)
  937. as
  938. select r.sname, r.dblink, r.masterdef, r.snapmaster, r.master_comment
  939. from repcat_repschema r, user_users u
  940. where r.sname = u.username
  941. /
  942. comment on table USER_REPSCHEMA is
  943. 'N-way replication information about the current user'
  944. /
  945. comment on column USER_REPSCHEMA.SNAME is
  946. 'Name of the user'
  947. /
  948. comment on column USER_REPSCHEMA.DBLINK is
  949. 'A database site replicating the schema'
  950. /
  951. comment on column USER_REPSCHEMA.MASTERDEF is
  952. 'Is the database the master definition site for the replicated schema'
  953. /
  954. comment on column USER_REPSCHEMA.SNAPMASTER is
  955. 'For snapshot sites, is the database the current refresh master'
  956. /
  957. comment on column USER_REPSCHEMA.MASTER_COMMENT is
  958. 'User description of the database site'
  959. /
  960. drop public synonym USER_REPSCHEMA
  961. /
  962. create public synonym USER_REPSCHEMA for USER_REPSCHEMA
  963. /
  964. grant select on USER_REPSCHEMA to PUBLIC with grant option
  965. /
  966. create or replace view ALL_REPSCHEMA
  967.     (SNAME, DBLINK, MASTERDEF, SNAPMASTER, MASTER_COMMENT)
  968. as
  969. select r.sname, r.dblink, r.masterdef, r.snapmaster, r.master_comment
  970. from repcat_repschema r, all_users u
  971. where r.sname = u.username
  972. /
  973. comment on table ALL_REPSCHEMA is
  974. 'N-way replication information'
  975. /
  976. comment on column ALL_REPSCHEMA.SNAME is
  977. 'Name of the replicated schema'
  978. /
  979. comment on column ALL_REPSCHEMA.DBLINK is
  980. 'A database site replicating the schema'
  981. /
  982. comment on column ALL_REPSCHEMA.MASTERDEF is
  983. 'Is the database the master definition site for the replicated schema'
  984. /
  985. comment on column ALL_REPSCHEMA.SNAPMASTER is
  986. 'For a snapshot site, is the database the current refresh master'
  987. /
  988. comment on column ALL_REPSCHEMA.MASTER_COMMENT is
  989. 'Description of the database site'
  990. /
  991. drop public synonym ALL_REPSCHEMA
  992. /
  993. create public synonym ALL_REPSCHEMA for ALL_REPSCHEMA
  994. /
  995. grant select on ALL_REPSCHEMA to PUBLIC with grant option
  996. /
  997. create or replace view DBA_REPSCHEMA
  998.     (SNAME, DBLINK, MASTERDEF, SNAPMASTER, MASTER_COMMENT, MASTER,
  999.      PROP_UPDATES, MY_DBLINK)
  1000. as
  1001. select r.sname, r.dblink, r.masterdef, r.snapmaster, r.master_comment,
  1002.   r.master, r.prop_updates, r.my_dblink
  1003. from system.repcat$_repschema r
  1004. /
  1005. comment on table DBA_REPSCHEMA is
  1006. 'N-way replication information'
  1007. /
  1008. comment on column DBA_REPSCHEMA.SNAME is
  1009. 'Name of the replicated schema'
  1010. /
  1011. comment on column DBA_REPSCHEMA.DBLINK is
  1012. 'A database site replicating the schema'
  1013. /
  1014. comment on column DBA_REPSCHEMA.MASTERDEF is
  1015. 'Is the database the master definition site for the replicated schema'
  1016. /
  1017. comment on column DBA_REPSCHEMA.SNAPMASTER is
  1018. 'For a snapshot site, is the database the current refresh master'
  1019. /
  1020. comment on column DBA_REPSCHEMA.MASTER_COMMENT is
  1021. 'Description of the database site'
  1022. /
  1023. comment on column DBA_REPSCHEMA.MASTER is
  1024. 'Redundant information from repcat$_repcat.master'
  1025. /
  1026. comment on column DBA_REPSCHEMA.PROP_UPDATES is
  1027. 'Number of requested updates for master in repcat$_repprop'
  1028. /
  1029. comment on column DBA_REPSCHEMA.MY_DBLINK is
  1030. 'A sanity check after import: is this master the current site'
  1031. /
  1032. create or replace view USER_REPOBJECT
  1033.     (SNAME, ONAME, TYPE, STATUS, ID, OBJECT_COMMENT)
  1034. as
  1035. select r.sname, r.oname, r.type, r.status, r.id, r.object_comment
  1036. from repcat_repobject r, user_users u
  1037. where r.sname = u.username
  1038. /
  1039. comment on table USER_REPOBJECT is
  1040. 'Replication information about the current user''s objects'
  1041. /
  1042. comment on column USER_REPOBJECT.SNAME is
  1043. 'Name of the user'
  1044. /
  1045. comment on column USER_REPOBJECT.ONAME is
  1046. 'Name of the object'
  1047. /
  1048. comment on column USER_REPOBJECT.TYPE is
  1049. 'Type of the object'
  1050. /
  1051. comment on column USER_REPOBJECT.STATUS is
  1052. 'Status of the last create or alter request on the local object'
  1053. /
  1054. comment on column USER_REPOBJECT.ID is
  1055. 'Identifier of the local object'
  1056. /
  1057. comment on column USER_REPOBJECT.OBJECT_COMMENT is
  1058. 'User description of the replicated object'
  1059. /
  1060. drop public synonym USER_REPOBJECT
  1061. /
  1062. create public synonym USER_REPOBJECT for USER_REPOBJECT
  1063. /
  1064. grant select on USER_REPOBJECT to PUBLIC with grant option
  1065. /
  1066. create or replace view ALL_REPOBJECT
  1067.     (SNAME, ONAME, TYPE, STATUS, ID, OBJECT_COMMENT)
  1068. as
  1069. select r.sname, r.oname, r.type, r.status, r.id, r.object_comment
  1070. from repcat_repobject r, all_users u, all_objects o
  1071. where r.sname = u.username
  1072.   and r.sname = o.owner
  1073.   and r.oname = o.object_name
  1074.   and (r.type = o.object_type
  1075.        or (r.type = 'SNAPSHOT'
  1076.            and o.object_type = 'VIEW'))
  1077. union
  1078. select r.sname, r.oname, r.type, r.status, r.id, r.object_comment
  1079. from user_repobject r
  1080. /
  1081. comment on table ALL_REPOBJECT is
  1082. 'Information about replicated objects'
  1083. /
  1084. comment on column ALL_REPOBJECT.SNAME is
  1085. 'Name of the object owner'
  1086. /
  1087. comment on column ALL_REPOBJECT.ONAME is
  1088. 'Name of the object'
  1089. /
  1090. comment on column ALL_REPOBJECT.TYPE is
  1091. 'Type of the object'
  1092. /
  1093. comment on column ALL_REPOBJECT.STATUS is
  1094. 'Status of the last create or alter request on the local object'
  1095. /
  1096. comment on column ALL_REPOBJECT.ID is
  1097. 'Identifier of the local object'
  1098. /
  1099. comment on column ALL_REPOBJECT.OBJECT_COMMENT is
  1100. 'Description of the replicated object'
  1101. /
  1102. drop public synonym ALL_REPOBJECT
  1103. /
  1104. create public synonym ALL_REPOBJECT for ALL_REPOBJECT
  1105. /
  1106. grant select on ALL_REPOBJECT to PUBLIC with grant option
  1107. /
  1108. create or replace view DBA_REPOBJECT
  1109.     (SNAME, ONAME, TYPE, STATUS, ID, OBJECT_COMMENT)
  1110. as
  1111. select r.sname, r.oname, r.type, r.status, r.id, r.object_comment
  1112. from repcat_repobject r
  1113. /
  1114. comment on table DBA_REPOBJECT is
  1115. 'Information about replicated objects'
  1116. /
  1117. comment on column DBA_REPOBJECT.SNAME is
  1118. 'Name of the object owner'
  1119. /
  1120. comment on column DBA_REPOBJECT.ONAME is
  1121. 'Name of the object'
  1122. /
  1123. comment on column DBA_REPOBJECT.TYPE is
  1124. 'Type of the object'
  1125. /
  1126. comment on column DBA_REPOBJECT.STATUS is
  1127. 'Status of the last create or alter request on the local object'
  1128. /
  1129. comment on column DBA_REPOBJECT.ID is
  1130. 'Identifier of the local object'
  1131. /
  1132. comment on column DBA_REPOBJECT.OBJECT_COMMENT is
  1133. 'Description of the replicated object'
  1134. /
  1135. create or replace view USER_REPPROP
  1136.     (SNAME, ONAME, TYPE, DBLINK, HOW, PROPAGATE_COMMENT)
  1137. as
  1138. select r.sname, r.oname, r.type, r.dblink, r.how, r.propagate_comment
  1139. from repcat_repprop r, repcat_repobject ro, user_users u
  1140. where r.sname = u.username
  1141.   and r.sname = ro.sname
  1142.   and r.oname = ro.oname
  1143.   and r.type = ro.type
  1144.   and ro.type in ('PROCEDURE', 'PACKAGE', 'PACKAGE BODY', 'TABLE')
  1145. /
  1146. comment on table USER_REPPROP is
  1147. 'Propagation information about the current user''s objects'
  1148. /
  1149. comment on column USER_REPPROP.SNAME is
  1150. 'Name of the user'
  1151. /
  1152. comment on column USER_REPPROP.ONAME is
  1153. 'Name of the object'
  1154. /
  1155. comment on column USER_REPPROP.TYPE is
  1156. 'Type of the object'
  1157. /
  1158. comment on column USER_REPPROP.DBLINK is
  1159. 'Destination database for propagation'
  1160. /
  1161. comment on column USER_REPPROP.HOW is
  1162. 'Propagation choice for the destination database'
  1163. /
  1164. comment on column USER_REPPROP.PROPAGATE_COMMENT is
  1165. 'User description of the propagation choice'
  1166. /
  1167. drop public synonym USER_REPPROP
  1168. /
  1169. create public synonym USER_REPPROP for USER_REPPROP
  1170. /
  1171. grant select on USER_REPPROP to PUBLIC with grant option
  1172. /
  1173. create or replace view ALL_REPPROP
  1174.     (SNAME, ONAME, TYPE, DBLINK, HOW, PROPAGATE_COMMENT)
  1175. as
  1176. select r.sname, r.oname, r.type, r.dblink, r.how, r.propagate_comment
  1177. from repcat_repprop r, all_repobject ro, all_users u
  1178. where r.sname = u.username
  1179.   and r.sname = ro.sname
  1180.   and r.oname = ro.oname
  1181.   and r.type = ro.type
  1182.   and ro.type in ('PROCEDURE', 'PACKAGE', 'PACKAGE BODY', 'TABLE')
  1183. /
  1184. comment on table ALL_REPPROP is
  1185. 'Propagation information about replicated objects'
  1186. /
  1187. comment on column ALL_REPPROP.SNAME is
  1188. 'Name of the object owner'
  1189. /
  1190. comment on column ALL_REPPROP.ONAME is
  1191. 'Name of the object'
  1192. /
  1193. comment on column ALL_REPPROP.TYPE is
  1194. 'Type of the object'
  1195. /
  1196. comment on column ALL_REPPROP.DBLINK is
  1197. 'Destination database for propagation'
  1198. /
  1199. comment on column ALL_REPPROP.HOW is
  1200. 'Propagation choice for the destination database'
  1201. /
  1202. comment on column ALL_REPPROP.PROPAGATE_COMMENT is
  1203. 'Description of the propagation choice'
  1204. /
  1205. drop public synonym ALL_REPPROP
  1206. /
  1207. create public synonym ALL_REPPROP for ALL_REPPROP
  1208. /
  1209. grant select on ALL_REPPROP to PUBLIC with grant option
  1210. /
  1211. create or replace view DBA_REPPROP
  1212.     (SNAME, ONAME, TYPE, DBLINK, HOW, PROPAGATE_COMMENT)
  1213. as
  1214. select r.sname, r.oname, r.type, r.dblink, r.how, r.propagate_comment
  1215. from repcat_repprop r, repcat_repobject ro
  1216. where r.sname = ro.sname
  1217.   and r.oname = ro.oname
  1218.   and r.type = ro.type
  1219.   and ro.type in ('PROCEDURE', 'PACKAGE', 'PACKAGE BODY', 'TABLE')
  1220. /
  1221. comment on table DBA_REPPROP is
  1222. 'Propagation information about replicated objects'
  1223. /
  1224. comment on column DBA_REPPROP.SNAME is
  1225. 'Name of the object owner'
  1226. /
  1227. comment on column DBA_REPPROP.ONAME is
  1228. 'Name of the object'
  1229. /
  1230. comment on column DBA_REPPROP.TYPE is
  1231. 'Type of the object'
  1232. /
  1233. comment on column DBA_REPPROP.DBLINK is
  1234. 'Destination database for propagation'
  1235. /
  1236. comment on column DBA_REPPROP.HOW is
  1237. 'Propagation choice for the destination database'
  1238. /
  1239. comment on column DBA_REPPROP.PROPAGATE_COMMENT is
  1240. 'Description of the propagation choice'
  1241. /
  1242. create or replace view USER_REPKEY_COLUMNS
  1243.     (SNAME, ONAME, COL)
  1244. as
  1245. select r.sname, r.oname, r.col
  1246. from system.repcat$_key_columns r, user_users u
  1247. where r.sname = u.username
  1248. /
  1249. comment on table USER_REPKEY_COLUMNS is
  1250. 'Primary columns for a table using column-level replication'
  1251. /
  1252. comment on column USER_REPKEY_COLUMNS.SNAME is
  1253. 'Schema containing table'
  1254. /
  1255. comment on column USER_REPKEY_COLUMNS.ONAME is
  1256. 'Name of the table'
  1257. /
  1258. comment on column USER_REPKEY_COLUMNS.COL is
  1259. 'Column in the table'
  1260. /
  1261. drop public synonym USER_REPKEY_COLUMNS
  1262. /
  1263. create public synonym USER_REPKEY_COLUMNS for USER_REPKEY_COLUMNS
  1264. /
  1265. grant select on USER_REPKEY_COLUMNS to PUBLIC with grant option
  1266. /
  1267. create or replace view ALL_REPKEY_COLUMNS
  1268.     (SNAME, ONAME, COL)
  1269. as
  1270. select r.sname, r.oname, r.col
  1271. from system.repcat$_key_columns r, all_repobject ro
  1272. where r.sname = ro.sname
  1273.   and r.oname = ro.oname
  1274.   and 'TABLE' = ro.type
  1275. /
  1276. comment on table ALL_REPKEY_COLUMNS is
  1277. 'Primary columns for a table using column-level replication'
  1278. /
  1279. comment on column ALL_REPKEY_COLUMNS.SNAME is
  1280. 'Schema containing table'
  1281. /
  1282. comment on column ALL_REPKEY_COLUMNS.ONAME is
  1283. 'Name of the table'
  1284. /
  1285. comment on column ALL_REPKEY_COLUMNS.COL is
  1286. 'Column in the table'
  1287. /
  1288. drop public synonym ALL_REPKEY_COLUMNS
  1289. /
  1290. create public synonym ALL_REPKEY_COLUMNS for ALL_REPKEY_COLUMNS
  1291. /
  1292. grant select on ALL_REPKEY_COLUMNS to PUBLIC with grant option
  1293. /
  1294. create or replace view DBA_REPKEY_COLUMNS
  1295.     (SNAME, ONAME, COL)
  1296. as
  1297. select r.sname, r.oname, r.col
  1298. from system.repcat$_key_columns r
  1299. /
  1300. comment on table DBA_REPKEY_COLUMNS is
  1301. 'Primary columns for a table using column-level replication'
  1302. /
  1303. comment on column DBA_REPKEY_COLUMNS.SNAME is
  1304. 'Schema containing table'
  1305. /
  1306. comment on column DBA_REPKEY_COLUMNS.ONAME is
  1307. 'Name of the table'
  1308. /
  1309. comment on column DBA_REPKEY_COLUMNS.COL is
  1310. 'Column in the table'
  1311. /
  1312. create or replace view USER_REPGENERATED
  1313.   (SNAME, ONAME, TYPE, BASE_SNAME, BASE_ONAME, BASE_TYPE, PACKAGE_PREFIX,
  1314.     PROCEDURE_PREFIX, DISTRIBUTED, REASON)
  1315. as
  1316. select r.sname, r.oname, r.type, r.base_sname, r.base_oname, r.base_type,
  1317.   r.package_prefix, r.procedure_prefix, r.distributed, r.reason
  1318. from repcat_generated r, user_users u
  1319. where r.base_sname = u.username
  1320. /
  1321. comment on table USER_REPGENERATED is
  1322. 'Objects generated for the current user to support replication'
  1323. /
  1324. comment on column USER_REPGENERATED.SNAME is
  1325. 'Schema containing the generated object'
  1326. /
  1327. comment on column USER_REPGENERATED.ONAME is
  1328. 'Name of the generated object'
  1329. /
  1330. comment on column USER_REPGENERATED.TYPE is
  1331. 'Type of the generated object'
  1332. /
  1333. comment on column USER_REPGENERATED.BASE_SNAME is
  1334. 'Name of the user'
  1335. /
  1336. comment on column USER_REPGENERATED.BASE_ONAME is
  1337. 'Name of the user''s object'
  1338. /
  1339. comment on column USER_REPGENERATED.BASE_TYPE is
  1340. 'Type of the user''s object'
  1341. /
  1342. comment on column USER_REPGENERATED.PACKAGE_PREFIX is
  1343. 'Prefix for package wrapper'
  1344. /
  1345. comment on column USER_REPGENERATED.PROCEDURE_PREFIX is
  1346. 'Procedure prefix for package wrapper or procedure wrapper'
  1347. /
  1348. comment on column USER_REPGENERATED.DISTRIBUTED is
  1349. 'Is the generated object separately generated at each master'
  1350. /
  1351. comment on column USER_REPGENERATED.REASON is
  1352. 'Reason the object was generated'
  1353. /
  1354. drop public synonym USER_REPGENERATED
  1355. /
  1356. create public synonym USER_REPGENERATED for USER_REPGENERATED
  1357. /
  1358. grant select on USER_REPGENERATED to PUBLIC with grant option
  1359. /
  1360. create or replace view ALL_REPGENERATED
  1361.   (SNAME, ONAME, TYPE, BASE_SNAME, BASE_ONAME, BASE_TYPE, PACKAGE_PREFIX,
  1362.     PROCEDURE_PREFIX, DISTRIBUTED, REASON)
  1363. as
  1364. select r.sname, r.oname, r.type, r.base_sname, r.base_oname, r.base_type,
  1365.   r.package_prefix, r.procedure_prefix, r.distributed, r.reason
  1366. from repcat_generated r, all_users u, all_objects o
  1367. where r.base_sname = u.username
  1368.   and r.base_sname = o.owner
  1369.   and r.base_oname = o.object_name
  1370.   and (r.base_type = o.object_type
  1371.        or (r.base_type = 'SNAPSHOT'
  1372.            and o.object_type = 'VIEW'))
  1373. union
  1374. select r.sname, r.oname, r.type, r.base_sname, r.base_oname, r.base_type,
  1375.   r.package_prefix, r.procedure_prefix, r.distributed, r.reason
  1376. from user_repgenerated r
  1377. /
  1378. comment on table ALL_REPGENERATED is
  1379. 'Objects generated to support replication'
  1380. /
  1381. comment on column ALL_REPGENERATED.SNAME is
  1382. 'Schema containing the generated object'
  1383. /
  1384. comment on column ALL_REPGENERATED.ONAME is
  1385. 'Name of the generated object'
  1386. /
  1387. comment on column ALL_REPGENERATED.TYPE is
  1388. 'Type of the generated object'
  1389. /
  1390. comment on column ALL_REPGENERATED.BASE_SNAME is
  1391. 'Name of the object''s owner'
  1392. /
  1393. comment on column ALL_REPGENERATED.BASE_ONAME is
  1394. 'Name of the object'
  1395. /
  1396. comment on column ALL_REPGENERATED.BASE_TYPE is
  1397. 'Type of the object'
  1398. /
  1399. comment on column ALL_REPGENERATED.PACKAGE_PREFIX is
  1400. 'Prefix for package wrapper'
  1401. /
  1402. comment on column ALL_REPGENERATED.PROCEDURE_PREFIX is
  1403. 'Procedure prefix for package wrapper or procedure wrapper'
  1404. /
  1405. comment on column ALL_REPGENERATED.DISTRIBUTED is
  1406. 'Is the generated object separately generated at each master'
  1407. /
  1408. comment on column ALL_REPGENERATED.REASON is
  1409. 'Reason the object was generated'
  1410. /
  1411. drop public synonym ALL_REPGENERATED
  1412. /
  1413. create public synonym ALL_REPGENERATED for ALL_REPGENERATED
  1414. /
  1415. grant select on ALL_REPGENERATED to PUBLIC with grant option
  1416. /
  1417. create or replace view DBA_REPGENERATED
  1418.   (SNAME, ONAME, TYPE, BASE_SNAME, BASE_ONAME, BASE_TYPE, PACKAGE_PREFIX,
  1419.     PROCEDURE_PREFIX, DISTRIBUTED, REASON)
  1420. as
  1421. select r.sname, r.oname, r.type, r.base_sname, r.base_oname, r.base_type,
  1422.   r.package_prefix, r.procedure_prefix, r.distributed, r.reason
  1423. from repcat_generated r
  1424. /
  1425. comment on table DBA_REPGENERATED is
  1426. 'Objects generated to support replication'
  1427. /
  1428. comment on column DBA_REPGENERATED.SNAME is
  1429. 'Schema containing the generated object'
  1430. /
  1431. comment on column DBA_REPGENERATED.ONAME is
  1432. 'Name of the generated object'
  1433. /
  1434. comment on column DBA_REPGENERATED.TYPE is
  1435. 'Type of the generated object'
  1436. /
  1437. comment on column DBA_REPGENERATED.BASE_SNAME is
  1438. 'Name of the object''s owner'
  1439. /
  1440. comment on column DBA_REPGENERATED.BASE_ONAME is
  1441. 'Name of the object'
  1442. /
  1443. comment on column DBA_REPGENERATED.BASE_TYPE is
  1444. 'Type of the object'
  1445. /
  1446. comment on column DBA_REPGENERATED.PACKAGE_PREFIX is
  1447. 'Prefix for package wrapper'
  1448. /
  1449. comment on column DBA_REPGENERATED.PROCEDURE_PREFIX is
  1450. 'Procedure prefix for package wrapper or procedure wrapper'
  1451. /
  1452. comment on column DBA_REPGENERATED.DISTRIBUTED is
  1453. 'Is the generated object separately generated at each master'
  1454. /
  1455. comment on column DBA_REPGENERATED.REASON is
  1456. 'Reason the object was generated'
  1457. /
  1458. create or replace view USER_REPCATLOG
  1459.     (ID, SOURCE, USERID, TIMESTAMP, ROLE, MASTER, SNAME, REQUEST, ONAME,
  1460.      TYPE, STATUS, MESSAGE, ERRNUM)
  1461. as
  1462. select r.id, r.source, r.userid, r.timestamp, r.role, r.master, r.sname,
  1463.   r.request, r.oname, r.type, r.status, r.message, r.errnum
  1464. from repcat_repcatlog r, user_users u
  1465. where r.sname = u.username or r.userid = u.username
  1466. /
  1467. comment on table USER_REPCATLOG is
  1468. 'Information about the current user''s asynchronous administration requests'
  1469. /
  1470. comment on column USER_REPCATLOG.ID is
  1471. 'Identifying number of repcat log record'
  1472. /
  1473. comment on column USER_REPCATLOG.SOURCE is
  1474. 'Name of the database at which the request originated'
  1475. /
  1476. comment on column USER_REPCATLOG.USERID is
  1477. 'Name of the user who submitted the request'
  1478. /
  1479. comment on column USER_REPCATLOG.TIMESTAMP is
  1480. 'When the request was submitted'
  1481. /
  1482. comment on column USER_REPCATLOG.ROLE is
  1483. 'Is this database the masterdef for the request'
  1484. /
  1485. comment on column USER_REPCATLOG.MASTER is
  1486. 'Name of the database that processes this request'
  1487. /
  1488. comment on column USER_REPCATLOG.SNAME is
  1489. 'Name of the replicated schema'
  1490. /
  1491. comment on column USER_REPCATLOG.REQUEST is
  1492. 'Name of the requested operation'
  1493. /
  1494. comment on column USER_REPCATLOG.ONAME is
  1495. 'Replicated object name, if applicable'
  1496. /
  1497. comment on column USER_REPCATLOG.TYPE is
  1498. 'Type of replicated object, if applicable'
  1499. /
  1500. comment on column USER_REPCATLOG.STATUS is
  1501. 'Status of the request at this database'
  1502. /
  1503. comment on column USER_REPCATLOG.MESSAGE is
  1504. 'Error message associated with processing the request'
  1505. /
  1506. comment on column USER_REPCATLOG.ERRNUM is
  1507. 'Oracle error number associated with processing the request'
  1508. /
  1509. drop public synonym USER_REPCATLOG
  1510. /
  1511. create public synonym USER_REPCATLOG for USER_REPCATLOG
  1512. /
  1513. grant select on USER_REPCATLOG to PUBLIC with grant option
  1514. /
  1515. create or replace view ALL_REPCATLOG
  1516.     (ID, SOURCE, USERID, TIMESTAMP, ROLE, MASTER, SNAME, REQUEST, ONAME,
  1517.      TYPE, STATUS, MESSAGE, ERRNUM)
  1518. as
  1519. select r.id, r.source, r.userid, r.timestamp, r.role, r.master, r.sname,
  1520.   r.request, r.oname, r.type, r.status, r.message, r.errnum
  1521. from repcat_repcatlog r, all_users u, all_objects o
  1522. where r.sname = u.username
  1523.   and r.sname = o.owner
  1524.   and r.oname = o.object_name
  1525.   and r.type = o.object_type
  1526. union
  1527. select r.id, r.source, r.userid, r.timestamp, r.role, r.master, r.sname,
  1528.   r.request, r.oname, r.type, r.status, r.message, r.errnum
  1529. from user_repcatlog r
  1530. /
  1531. comment on table ALL_REPCATLOG is
  1532. 'Information about asynchronous administration requests'
  1533. /
  1534. comment on column ALL_REPCATLOG.ID is
  1535. 'Identifying number of repcat log record'
  1536. /
  1537. comment on column ALL_REPCATLOG.SOURCE is
  1538. 'Name of the database at which the request originated'
  1539. /
  1540. comment on column ALL_REPCATLOG.USERID is
  1541. 'Name of the user who submitted the request'
  1542. /
  1543. comment on column ALL_REPCATLOG.TIMESTAMP is
  1544. 'When the request was submitted'
  1545. /
  1546. comment on column ALL_REPCATLOG.ROLE is
  1547. 'Is this database the masterdef for the request'
  1548. /
  1549. comment on column ALL_REPCATLOG.MASTER is
  1550. 'Name of the database that processes this request'
  1551. /
  1552. comment on column ALL_REPCATLOG.SNAME is
  1553. 'Name of the replicated schema'
  1554. /
  1555. comment on column ALL_REPCATLOG.REQUEST is
  1556. 'Name of the requested operation'
  1557. /
  1558. comment on column ALL_REPCATLOG.ONAME is
  1559. 'Replicated object name, if applicable'
  1560. /
  1561. comment on column ALL_REPCATLOG.TYPE is
  1562. 'Type of replicated object, if applicable'
  1563. /
  1564. comment on column ALL_REPCATLOG.STATUS is
  1565. 'Status of the request at this database'
  1566. /
  1567. comment on column ALL_REPCATLOG.MESSAGE is
  1568. 'Error message associated with processing the request'
  1569. /
  1570. comment on column ALL_REPCATLOG.ERRNUM is
  1571. 'Oracle error number associated with processing the request'
  1572. /
  1573. drop public synonym ALL_REPCATLOG
  1574. /
  1575. create public synonym ALL_REPCATLOG for ALL_REPCATLOG
  1576. /
  1577. grant select on ALL_REPCATLOG to PUBLIC with grant option
  1578. /
  1579. create or replace view DBA_REPCATLOG
  1580.     (ID, SOURCE, STATUS, USERID, TIMESTAMP, ROLE, MASTER, SNAME, REQUEST,
  1581.      ONAME, TYPE, MESSAGE, ERRNUM)
  1582. as
  1583. select r.id, r.source, r.status, r.userid, r.timestamp, r.role, r.master,
  1584.   r.sname, r.request, r.oname, r.type, r.message, r.errnum
  1585. from repcat_repcatlog r
  1586. /
  1587. comment on table DBA_REPCATLOG is
  1588. 'Information about asynchronous administration requests'
  1589. /
  1590. comment on column DBA_REPCATLOG.ID is
  1591. 'Identifying number of repcat log record'
  1592. /
  1593. comment on column DBA_REPCATLOG.SOURCE is
  1594. 'Name of the database at which the request originated'
  1595. /
  1596. comment on column DBA_REPCATLOG.STATUS is
  1597. 'Status of the request at this database'
  1598. /
  1599. comment on column DBA_REPCATLOG.USERID is
  1600. 'Name of the user who submitted the request'
  1601. /
  1602. comment on column DBA_REPCATLOG.TIMESTAMP is
  1603. 'When the request was submitted'
  1604. /
  1605. comment on column DBA_REPCATLOG.ROLE is
  1606. 'Is this database the masterdef for the request'
  1607. /
  1608. comment on column DBA_REPCATLOG.MASTER is
  1609. 'Name of the database that processes this request'
  1610. /
  1611. comment on column DBA_REPCATLOG.SNAME is
  1612. 'Name of the replicated schema'
  1613. /
  1614. comment on column DBA_REPCATLOG.REQUEST is
  1615. 'Name of the requested operation'
  1616. /
  1617. comment on column DBA_REPCATLOG.ONAME is
  1618. 'Replicated object name, if applicable'
  1619. /
  1620. comment on column DBA_REPCATLOG.TYPE is
  1621. 'Type of replicated object, if applicable'
  1622. /
  1623. comment on column DBA_REPCATLOG.MESSAGE is
  1624. 'Error message associated with processing the request'
  1625. /
  1626. comment on column DBA_REPCATLOG.ERRNUM is
  1627. 'Oracle error number associated with processing the request'
  1628. /
  1629. create or replace view USER_REPDDL
  1630.   (LOG_ID, SOURCE, ROLE, MASTER, LINE, TEXT)
  1631. as
  1632. select r.log_id, r.source, r.role, r.master, r.line, r.text
  1633. from system.repcat$_ddl r, user_repcatlog u
  1634. where r.log_id = u.id
  1635.   and r.source = u.source
  1636. /
  1637. comment on table USER_REPDDL is
  1638. 'Arguments that do not fit in a single repcat log record'
  1639. /
  1640. comment on column USER_REPDDL.LOG_ID is
  1641. 'Identifying number of the repcat log record'
  1642. /
  1643. comment on column USER_REPDDL.SOURCE is
  1644. 'Name of the database at which the request originated'
  1645. /
  1646. comment on column USER_REPDDL.ROLE is
  1647. 'Is this database the masterdef for the request'
  1648. /
  1649. comment on column USER_REPDDL.MASTER is
  1650. 'Name of the database that processes this request'
  1651. /
  1652. comment on column USER_REPDDL.LINE is
  1653. 'Ordering of records within a single request'
  1654. /
  1655. comment on column USER_REPDDL.TEXT is
  1656. 'Portion of an argument'
  1657. /
  1658. drop public synonym USER_REPDDL
  1659. /
  1660. create public synonym USER_REPDDL for USER_REPDDL
  1661. /
  1662. grant select on USER_REPDDL to PUBLIC with grant option
  1663. /
  1664. create or replace view ALL_REPDDL
  1665.   (LOG_ID, SOURCE, ROLE, MASTER, LINE, TEXT)
  1666. as
  1667. select r.log_id, r.source, r.role, r.master, r.line, r.text
  1668. from system.repcat$_ddl r, all_repcatlog u
  1669. where r.log_id = u.id
  1670.   and r.source = u.source
  1671. /
  1672. comment on table ALL_REPDDL is
  1673. 'Arguments that do not fit in a single repcat log record'
  1674. /
  1675. comment on column ALL_REPDDL.LOG_ID is
  1676. 'Identifying number of the repcat log record'
  1677. /
  1678. comment on column ALL_REPDDL.SOURCE is
  1679. 'Name of the database at which the request originated'
  1680. /
  1681. comment on column ALL_REPDDL.ROLE is
  1682. 'Is this database the masterdef for the request'
  1683. /
  1684. comment on column ALL_REPDDL.MASTER is
  1685. 'Name of the database that processes this request'
  1686. /
  1687. comment on column ALL_REPDDL.LINE is
  1688. 'Ordering of records within a single request'
  1689. /
  1690. comment on column ALL_REPDDL.TEXT is
  1691. 'Portion of an argument'
  1692. /
  1693. drop public synonym ALL_REPDDL
  1694. /
  1695. create public synonym ALL_REPDDL for ALL_REPDDL
  1696. /
  1697. grant select on ALL_REPDDL to PUBLIC with grant option
  1698. /
  1699. create or replace view DBA_REPDDL
  1700.   (LOG_ID, SOURCE, ROLE, MASTER, LINE, TEXT)
  1701. as
  1702. select r.log_id, r.source, r.role, r.master, r.line, r.text
  1703. from system.repcat$_ddl r
  1704. /
  1705. comment on table DBA_REPDDL is
  1706. 'Arguments that do not fit in a single repcat log record'
  1707. /
  1708. comment on column DBA_REPDDL.LOG_ID is
  1709. 'Identifying number of the repcat log record'
  1710. /
  1711. comment on column DBA_REPDDL.SOURCE is
  1712. 'Name of the database at which the request originated'
  1713. /
  1714. comment on column DBA_REPDDL.ROLE is
  1715. 'Is this database the masterdef for the request'
  1716. /
  1717. comment on column DBA_REPDDL.MASTER is
  1718. 'Name of the database that processes this request'
  1719. /
  1720. comment on column DBA_REPDDL.LINE is
  1721. 'Ordering of records within a single request'
  1722. /
  1723. comment on column DBA_REPDDL.TEXT is
  1724. 'Portion of an argument'
  1725. /
  1726.  
  1727.  
  1728.  
  1729. create table system.repcat$_priority_group
  1730. (
  1731.     sname                  varchar2(30),
  1732.     priority_group         varchar2(30),
  1733.     data_type_id           integer
  1734.                                constraint repcat$_priority_group_nn1
  1735.                                  not null
  1736.                                constraint repcat$_priority_group_c1
  1737.                                  check (data_type_id in (1, 2, 3, 4, 5)),
  1738.     fixed_data_length      integer,
  1739.     priority_comment      varchar2(80),
  1740.         constraint repcat$_priority_group_pk
  1741.           primary key (priority_group, sname),
  1742.         constraint repcat$_priority_group_u1
  1743.           unique (sname, priority_group, data_type_id, fixed_data_length),
  1744.         constraint repcat$_priority_group_c2
  1745.           check ((data_type_id = 4 and
  1746.                   fixed_data_length is not null)
  1747.               or (data_type_id in (1, 2, 3, 5) and
  1748.                   fixed_data_length is null))
  1749. )
  1750. /
  1751. comment on table system.repcat$_priority_group is
  1752. 'Information about all priority groups in the database'
  1753. /
  1754. comment on column system.repcat$_priority_group.sname is
  1755. 'Name of the replicated schema'
  1756. /
  1757. comment on column system.repcat$_priority_group.priority_group is
  1758. 'Name of the priority group'
  1759. /
  1760. comment on column system.repcat$_priority_group.data_type_id is
  1761. 'Datatype of the value in the priority group'
  1762. /
  1763. comment on column system.repcat$_priority_group.fixed_data_length is
  1764. 'Length of the value in bytes if the datatype is CHAR'
  1765. /
  1766. comment on column system.repcat$_priority_group.priority_comment is
  1767. 'Description of the priority group'
  1768. /
  1769.  
  1770.  
  1771.  
  1772.  
  1773. create or replace view dba_reppriority_group
  1774. (
  1775.     sname,
  1776.     priority_group,
  1777.     data_type,
  1778.     fixed_data_length,
  1779.     priority_comment
  1780. )
  1781. as
  1782. select
  1783.     sname,
  1784.     priority_group,
  1785.     decode(data_type_id,
  1786.            1, 'NUMBER',
  1787.            2, 'VARCHAR2',
  1788.            3, 'DATE',
  1789.            4, 'CHAR',
  1790.            5, 'RAW',
  1791.            'UNDEFINED'),
  1792.     fixed_data_length,
  1793.     priority_comment
  1794. from  system.repcat$_priority_group
  1795. /
  1796. comment on table dba_reppriority_group is
  1797. 'Information about all priority groups in the database'
  1798. /
  1799. comment on column dba_reppriority_group.sname is
  1800. 'Name of the replicated schema'
  1801. /
  1802. comment on column dba_reppriority_group.priority_group is
  1803. 'Name of the priority group'
  1804. /
  1805. comment on column dba_reppriority_group.data_type is
  1806. 'Datatype of the value in the priority group'
  1807. /
  1808. comment on column dba_reppriority_group.fixed_data_length is
  1809. 'Length of the value in bytes if the datatype is CHAR'
  1810. /
  1811. comment on column dba_reppriority_group.priority_comment is
  1812. 'Description of the priority group'
  1813. /
  1814.  
  1815.  
  1816.  
  1817.  
  1818. create or replace view all_reppriority_group
  1819. (
  1820.     sname,
  1821.     priority_group,
  1822.     data_type,
  1823.     fixed_data_length,
  1824.     priority_comment
  1825. )
  1826. as
  1827. select
  1828.     sname,
  1829.     priority_group,
  1830.     decode(data_type_id,
  1831.            1, 'NUMBER',
  1832.            2, 'VARCHAR2',
  1833.            3, 'DATE',
  1834.            4, 'CHAR',
  1835.            5, 'RAW',
  1836.            'UNDEFINED'),
  1837.     fixed_data_length,
  1838.     priority_comment
  1839. from  system.repcat$_priority_group
  1840. /
  1841. comment on table all_reppriority_group is
  1842. 'Information about all priority groups which are accessible to the user'
  1843. /
  1844. comment on column all_reppriority_group.sname is
  1845. 'Name of the replicated schema'
  1846. /
  1847. comment on column all_reppriority_group.priority_group is
  1848. 'Name of the priority group'
  1849. /
  1850. comment on column all_reppriority_group.data_type is
  1851. 'Datatype of the value in the priority group'
  1852. /
  1853. comment on column all_reppriority_group.fixed_data_length is
  1854. 'Length of the value in bytes if the datatype is CHAR'
  1855. /
  1856. comment on column all_reppriority_group.priority_comment is
  1857. 'Description of the priority group'
  1858. /
  1859. drop public synonym all_reppriority_group
  1860. /
  1861. create public synonym all_reppriority_group for all_reppriority_group
  1862. /
  1863. grant select on all_reppriority_group to public with grant option
  1864. /
  1865.  
  1866.  
  1867.  
  1868.  
  1869. create or replace view user_reppriority_group
  1870. (
  1871.     priority_group,
  1872.     data_type,
  1873.     fixed_data_length,
  1874.     priority_comment
  1875. )
  1876. as
  1877. select
  1878.     priority_group,
  1879.     decode(data_type_id,
  1880.            1, 'NUMBER',
  1881.            2, 'VARCHAR2',
  1882.            3, 'DATE',
  1883.            4, 'CHAR',
  1884.            5, 'RAW',
  1885.            'UNDEFINED'),
  1886.     fixed_data_length,
  1887.     priority_comment
  1888. from  system.repcat$_priority_group
  1889. where sname = USER
  1890. /
  1891. comment on table user_reppriority_group is
  1892. 'Information about user''s priority groups'
  1893. /
  1894. comment on column user_reppriority_group.priority_group is
  1895. 'Name of the priority group'
  1896. /
  1897. comment on column user_reppriority_group.data_type is
  1898. 'Datatype of the value'
  1899. /
  1900. comment on column user_reppriority_group.fixed_data_length is
  1901. 'Length of the value in bytes if the datatype is CHAR'
  1902. /
  1903. comment on column user_reppriority_group.priority_comment is
  1904. 'Description of the priority group'
  1905. /
  1906. drop public synonym user_reppriority_group
  1907. /
  1908. create public synonym user_reppriority_group for user_reppriority_group
  1909. /
  1910. grant select on user_reppriority_group to public with grant option
  1911. /
  1912.  
  1913.  
  1914.  
  1915.  
  1916. create table system.repcat$_priority
  1917. (
  1918.     sname                  varchar2(30)
  1919.                                constraint repcat$_priority_nn1
  1920.                                  not null,
  1921.     priority_group         varchar2(30)
  1922.                                constraint repcat$_priority_nn2
  1923.                                  not null,
  1924.     priority               number
  1925.                                constraint repcat$_priority_nn3
  1926.                                  not null,
  1927.     raw_value              raw(255),
  1928.     char_value             char(255),
  1929.     number_value           number,
  1930.     date_value             date,
  1931.     varchar2_value         varchar2(2000),
  1932.         constraint repcat$_priority_pk
  1933.           primary key (sname, priority_group, priority),
  1934.         constraint repcat$_priority_f1
  1935.           foreign key (priority_group, sname)
  1936.           references system.repcat$_priority_group
  1937. )
  1938. /
  1939. comment on table system.repcat$_priority is
  1940. 'Values and their corresponding priorities in all priority groups in the database'
  1941. /
  1942. comment on column system.repcat$_priority.sname is
  1943. 'Name of the replicated schema'
  1944. /
  1945. comment on column system.repcat$_priority.priority_group is
  1946. 'Name of the priority group'
  1947. /
  1948. comment on column system.repcat$_priority.priority is
  1949. 'Priority of the value'
  1950. /
  1951. comment on column system.repcat$_priority.raw_value is
  1952. 'Raw value'
  1953. /
  1954. comment on column system.repcat$_priority.char_value is
  1955. 'Blank-padded character string'
  1956. /
  1957. comment on column system.repcat$_priority.number_value is
  1958. 'Numeric value'
  1959. /
  1960. comment on column system.repcat$_priority.date_value is
  1961. 'Date value'
  1962. /
  1963. comment on column system.repcat$_priority.varchar2_value is
  1964. 'Character string'
  1965. /
  1966.  
  1967.  
  1968.  
  1969.  
  1970. create or replace view dba_reppriority
  1971. (
  1972.     sname,
  1973.     priority_group,
  1974.     priority,
  1975.     data_type,
  1976.     fixed_data_length,
  1977.     char_value,
  1978.     varchar2_value,
  1979.     number_value,
  1980.     date_value,
  1981.     raw_value
  1982. )
  1983. as
  1984. select
  1985.     p.sname,
  1986.     p.priority_group,
  1987.     v.priority,
  1988.     decode(p.data_type_id,
  1989.            1, 'NUMBER',
  1990.            2, 'VARCHAR2',
  1991.            3, 'DATE',
  1992.            4, 'CHAR',
  1993.            5, 'RAW',
  1994.            'UNDEFINED'),
  1995.     p.fixed_data_length,
  1996.     v.char_value,
  1997.     v.varchar2_value,
  1998.     v.number_value,
  1999.     v.date_value,
  2000.     v.raw_value
  2001. from  system.repcat$_priority v,
  2002.       system.repcat$_priority_group p
  2003. where v.sname = p.sname
  2004. and   v.priority_group = p.priority_group
  2005. /
  2006. comment on table dba_reppriority is
  2007. 'Values and their corresponding priorities in all priority groups in the database'
  2008. /
  2009. comment on column dba_reppriority.sname is
  2010. 'Name of the replicated schema'
  2011. /
  2012. comment on column dba_reppriority.priority_group is
  2013. 'Name of the priority group'
  2014. /
  2015. comment on column dba_reppriority.priority is
  2016. 'Priority of the value'
  2017. /
  2018. comment on column dba_reppriority.data_type is
  2019. 'Datatype of the value'
  2020. /
  2021. comment on column dba_reppriority.fixed_data_length is
  2022. 'Length of the value in bytes if the datatype is CHAR'
  2023. /
  2024. comment on column dba_reppriority.raw_value is
  2025. 'Raw value'
  2026. /
  2027. comment on column dba_reppriority.char_value is
  2028. 'Blank-padded character string'
  2029. /
  2030. comment on column dba_reppriority.number_value is
  2031. 'Numeric value'
  2032. /
  2033. comment on column dba_reppriority.date_value is
  2034. 'Date value'
  2035. /
  2036. comment on column dba_reppriority.varchar2_value is
  2037. 'Character string'
  2038. /
  2039.  
  2040.  
  2041.  
  2042.  
  2043. create or replace view all_reppriority
  2044. (
  2045.     sname,
  2046.     priority_group,
  2047.     priority,
  2048.     data_type,
  2049.     fixed_data_length,
  2050.     char_value,
  2051.     varchar2_value,
  2052.     number_value,
  2053.     date_value,
  2054.     raw_value
  2055. )
  2056. as
  2057. select
  2058.     p.sname,
  2059.     p.priority_group,
  2060.     v.priority,
  2061.     decode(p.data_type_id,
  2062.            1, 'NUMBER',
  2063.            2, 'VARCHAR2',
  2064.            3, 'DATE',
  2065.            4, 'CHAR',
  2066.            5, 'RAW',
  2067.            'UNDEFINED'),
  2068.     p.fixed_data_length,
  2069.     v.char_value,
  2070.     v.varchar2_value,
  2071.     v.number_value,
  2072.     v.date_value,
  2073.     v.raw_value
  2074. from  system.repcat$_priority v,
  2075.       system.repcat$_priority_group p
  2076. where v.sname = p.sname
  2077. and   v.priority_group = p.priority_group
  2078. /
  2079. comment on table all_reppriority is
  2080. 'Values and their corresponding priorities in all priority groups which are accessible to the user'
  2081. /
  2082. comment on column all_reppriority.sname is
  2083. 'Name of the replicated schema'
  2084. /
  2085. comment on column all_reppriority.priority_group is
  2086. 'Name of the priority group'
  2087. /
  2088. comment on column all_reppriority.priority is
  2089. 'Priority of the value'
  2090. /
  2091. comment on column all_reppriority.data_type is
  2092. 'Datatype of the value'
  2093. /
  2094. comment on column all_reppriority.fixed_data_length is
  2095. 'Length of the value in bytes if the datatype is CHAR'
  2096. /
  2097. comment on column all_reppriority.raw_value is
  2098. 'Raw value'
  2099. /
  2100. comment on column all_reppriority.char_value is
  2101. 'Blank-padded character string'
  2102. /
  2103. comment on column all_reppriority.number_value is
  2104. 'Numeric value'
  2105. /
  2106. comment on column all_reppriority.date_value is
  2107. 'Date value'
  2108. /
  2109. comment on column all_reppriority.varchar2_value is
  2110. 'Character string'
  2111. /
  2112. drop public synonym all_reppriority
  2113. /
  2114. create public synonym all_reppriority for all_reppriority
  2115. /
  2116. grant select on all_reppriority to public with grant option
  2117. /
  2118.  
  2119.  
  2120.  
  2121.  
  2122. create or replace view user_reppriority
  2123. (
  2124.     priority_group,
  2125.     priority,
  2126.     data_type,
  2127.     fixed_data_length,
  2128.     char_value,
  2129.     varchar2_value,
  2130.     number_value,
  2131.     date_value,
  2132.     raw_value
  2133. )
  2134. as
  2135. select
  2136.     p.priority_group,
  2137.     v.priority,
  2138.     decode(p.data_type_id,
  2139.            1, 'NUMBER',
  2140.            2, 'VARCHAR2',
  2141.            3, 'DATE',
  2142.            4, 'CHAR',
  2143.            5, 'RAW',
  2144.            'UNDEFINED'),
  2145.     p.fixed_data_length,
  2146.     v.char_value,
  2147.     v.varchar2_value,
  2148.     v.number_value,
  2149.     v.date_value,
  2150.     v.raw_value
  2151. from  system.repcat$_priority v,
  2152.       system.repcat$_priority_group p
  2153. where v.sname = USER
  2154. and   p.sname = USER
  2155. and   v.priority_group = p.priority_group
  2156. /
  2157. comment on table user_reppriority is
  2158. 'Values and their corresponding priorities in user''s priority groups'
  2159. /
  2160. comment on column user_reppriority.priority_group is
  2161. 'Name of the priority group'
  2162. /
  2163. comment on column user_reppriority.priority is
  2164. 'Priority of the value'
  2165. /
  2166. comment on column user_reppriority.data_type is
  2167. 'Datatype of the value'
  2168. /
  2169. comment on column user_reppriority.fixed_data_length is
  2170. 'Length of the value in bytes if the datatype is CHAR'
  2171. /
  2172. comment on column user_reppriority.raw_value is
  2173. 'Raw value'
  2174. /
  2175. comment on column user_reppriority.char_value is
  2176. 'Blank-padded character string'
  2177. /
  2178. comment on column user_reppriority.number_value is
  2179. 'Numeric value'
  2180. /
  2181. comment on column user_reppriority.date_value is
  2182. 'Date value'
  2183. /
  2184. comment on column user_reppriority.varchar2_value is
  2185. 'Character string'
  2186. /
  2187. drop public synonym user_reppriority
  2188. /
  2189. create public synonym user_reppriority for user_reppriority
  2190. /
  2191. grant select on user_reppriority to public with grant option
  2192. /
  2193.  
  2194.  
  2195.  
  2196.  
  2197. create table system.repcat$_column_group
  2198. (
  2199.     sname                  varchar2(30)
  2200.                                constraint repcat$_column_group_nn1
  2201.                                  not null,
  2202.     oname                  varchar2(30)
  2203.                                constraint repcat$_column_group_nn2
  2204.                                  not null,
  2205.     group_name             varchar2(30)
  2206.                                constraint repcat$_column_group_nn3
  2207.                                  not null,
  2208.     group_comment          varchar2(80),
  2209.         constraint repcat$_column_group_pk
  2210.           primary key (sname, oname, group_name)
  2211. )
  2212. /
  2213. comment on table system.repcat$_column_group is
  2214. 'All column groups of replicated tables in the database'
  2215. /
  2216. comment on column system.repcat$_column_group.sname is
  2217. 'Name of the replicated schema'
  2218. /
  2219. comment on column system.repcat$_column_group.oname is
  2220. 'Name of the replicated table'
  2221. /
  2222. comment on column system.repcat$_column_group.group_name is
  2223. 'Name of the column group'
  2224. /
  2225. comment on column system.repcat$_column_group.group_comment is
  2226. 'Description of the column group'
  2227. /
  2228.  
  2229.  
  2230.  
  2231.  
  2232. create or replace view dba_repcolumn_group
  2233. (
  2234.     sname,
  2235.     oname,
  2236.     group_name,
  2237.     group_comment
  2238. )
  2239. as
  2240. select
  2241.     sname,
  2242.     oname,
  2243.     group_name,
  2244.     group_comment
  2245. from  system.repcat$_column_group
  2246. /
  2247. comment on table dba_repcolumn_group is
  2248. 'All column groups of replicated tables in the database'
  2249. /
  2250. comment on column dba_repcolumn_group.sname is
  2251. 'Name of the replicated schema'
  2252. /
  2253. comment on column dba_repcolumn_group.oname is
  2254. 'Name of the replicated table'
  2255. /
  2256. comment on column dba_repcolumn_group.group_name is
  2257. 'Name of the column group'
  2258. /
  2259. comment on column dba_repcolumn_group.group_comment is
  2260. 'Description of the column group'
  2261. /
  2262.  
  2263.  
  2264.  
  2265.  
  2266. create or replace view all_repcolumn_group
  2267. (
  2268.     sname,
  2269.     oname,
  2270.     group_name,
  2271.     group_comment
  2272. )
  2273. as
  2274. select
  2275.     sname,
  2276.     oname,
  2277.     group_name,
  2278.     group_comment
  2279. from system.repcat$_column_group,
  2280.      sys.user$ u, sys.obj$ o
  2281. where sname = u.name
  2282.   and oname = o.name
  2283.   and o.owner# = u.user#
  2284.   and o.type = 2 /* tables */
  2285.   and (o.owner# = userenv('SCHEMAID')
  2286.         or
  2287.        o.obj# in ( select obj#
  2288.                    from objauth$
  2289.                    where grantee# in ( select kzsrorol
  2290.                                        from x$kzsro
  2291.                                      )
  2292.                   )
  2293.         or
  2294.      exists (select null from v$enabledprivs
  2295.              where priv_number in (-45 /* LOCK ANY TABLE */,
  2296.                        -47 /* SELECT ANY TABLE */,
  2297.                        -48 /* INSERT ANY TABLE */,
  2298.                        -49 /* UPDATE ANY TABLE */,
  2299.                        -50 /* DELETE ANY TABLE */)
  2300.                  )
  2301.        )
  2302. /
  2303. comment on table all_repcolumn_group is
  2304. 'All column groups of replicated tables which are accessible to the user'
  2305. /
  2306. comment on column all_repcolumn_group.sname is
  2307. 'Name of the replicated schema'
  2308. /
  2309. comment on column all_repcolumn_group.oname is
  2310. 'Name of the replicated table'
  2311. /
  2312. comment on column all_repcolumn_group.group_name is
  2313. 'Name of the column group'
  2314. /
  2315. comment on column all_repcolumn_group.group_comment is
  2316. 'Description of the column group'
  2317. /
  2318. drop public synonym all_repcolumn_group
  2319. /
  2320. create public synonym all_repcolumn_group for all_repcolumn_group
  2321. /
  2322. grant select on all_repcolumn_group to public with grant option
  2323. /
  2324.  
  2325.  
  2326.  
  2327.  
  2328. create or replace view user_repcolumn_group
  2329. (
  2330.     oname,
  2331.     group_name,
  2332.     group_comment
  2333. )
  2334. as
  2335. select
  2336.     oname,
  2337.     group_name,
  2338.     group_comment
  2339. from  system.repcat$_column_group
  2340. where sname = USER
  2341. /
  2342. comment on table user_repcolumn_group is
  2343. 'All column groups of user''s replicated tables'
  2344. /
  2345. comment on column user_repcolumn_group.oname is
  2346. 'Name of the replicated table'
  2347. /
  2348. comment on column user_repcolumn_group.group_name is
  2349. 'Name of the column group'
  2350. /
  2351. comment on column user_repcolumn_group.group_comment is
  2352. 'Description of the column group'
  2353. /
  2354. drop public synonym user_repcolumn_group
  2355. /
  2356. create public synonym user_repcolumn_group for user_repcolumn_group
  2357. /
  2358. grant select on user_repcolumn_group to public with grant option
  2359. /
  2360.  
  2361.  
  2362.  
  2363.  
  2364. create table system.repcat$_grouped_column
  2365. (
  2366.     sname                  varchar2(30),
  2367.     oname                  varchar2(30),
  2368.     group_name             varchar2(30),
  2369.     column_name            varchar2(30),
  2370.         constraint repcat$_grouped_column_pk
  2371.           primary key (sname, oname, group_name, column_name),
  2372.         constraint repcat$_grouped_column_f1
  2373.           foreign key (sname, oname, group_name)
  2374.           references system.repcat$_column_group
  2375. )
  2376. /
  2377. comment on table system.repcat$_grouped_column is
  2378. 'Columns in all column groups of replicated tables in the database'
  2379. /
  2380. comment on column system.repcat$_grouped_column.sname is
  2381. 'Name of the replicated schema'
  2382. /
  2383. comment on column system.repcat$_grouped_column.oname is
  2384. 'Name of the replicated table'
  2385. /
  2386. comment on column system.repcat$_grouped_column.group_name is
  2387. 'Name of the column group'
  2388. /
  2389. comment on column system.repcat$_grouped_column.column_name is
  2390. 'Name of the column in the column group'
  2391. /
  2392.  
  2393.  
  2394.  
  2395.  
  2396. create or replace view dba_repgrouped_column
  2397. (
  2398.     sname,
  2399.     oname,
  2400.     group_name,
  2401.     column_name
  2402. )
  2403. as
  2404. select
  2405.     sname,
  2406.     oname,
  2407.     group_name,
  2408.     column_name
  2409. from  system.repcat$_grouped_column
  2410. /
  2411. comment on table dba_repgrouped_column is
  2412. 'Columns in the all column groups of replicated tables in the database'
  2413. /
  2414. comment on column dba_repgrouped_column.sname is
  2415. 'Name of the replicated schema'
  2416. /
  2417. comment on column dba_repgrouped_column.oname is
  2418. 'Name of the replicated table'
  2419. /
  2420. comment on column dba_repgrouped_column.group_name is
  2421. 'Name of the column group'
  2422. /
  2423. comment on column dba_repgrouped_column.column_name is
  2424. 'Name of the column in the column group'
  2425. /
  2426.  
  2427.  
  2428.  
  2429.  
  2430. create or replace view all_repgrouped_column
  2431. (
  2432.     sname,
  2433.     oname,
  2434.     group_name,
  2435.     column_name
  2436. )
  2437. as
  2438. select
  2439.     sname,
  2440.     oname,
  2441.     group_name,
  2442.     column_name
  2443. from  system.repcat$_grouped_column,
  2444.       sys.user$ u, sys.obj$ o
  2445. where sname = u.name
  2446.   and oname = o.name
  2447.   and o.owner# = u.user#
  2448.   and o.type = 2 /* tables */
  2449.   and (o.owner# = userenv('SCHEMAID')
  2450.         or
  2451.        o.obj# in ( select obj#
  2452.                    from objauth$
  2453.                    where grantee# in ( select kzsrorol
  2454.                                        from x$kzsro
  2455.                                      )
  2456.                   )
  2457.         or
  2458.      exists (select null from v$enabledprivs
  2459.              where priv_number in (-45 /* LOCK ANY TABLE */,
  2460.                        -47 /* SELECT ANY TABLE */,
  2461.                        -48 /* INSERT ANY TABLE */,
  2462.                        -49 /* UPDATE ANY TABLE */,
  2463.                        -50 /* DELETE ANY TABLE */)
  2464.                  )
  2465.        )
  2466. /
  2467. comment on table all_repgrouped_column is
  2468. 'Columns in the all column groups of replicated tables which are accessible to the user'
  2469. /
  2470. comment on column all_repgrouped_column.sname is
  2471. 'Name of the replicated schema'
  2472. /
  2473. comment on column all_repgrouped_column.oname is
  2474. 'Name of the replicated table'
  2475. /
  2476. comment on column all_repgrouped_column.group_name is
  2477. 'Name of the column group'
  2478. /
  2479. comment on column all_repgrouped_column.column_name is
  2480. 'Name of the column in the column group'
  2481. /
  2482. drop public synonym all_repgrouped_column
  2483. /
  2484. create public synonym all_repgrouped_column for all_repgrouped_column
  2485. /
  2486. grant select on all_repgrouped_column to public with grant option
  2487. /
  2488.  
  2489.  
  2490.  
  2491.  
  2492. create or replace view user_repgrouped_column
  2493. (
  2494.     oname,
  2495.     group_name,
  2496.     column_name
  2497. )
  2498. as
  2499. select
  2500.     oname,
  2501.     group_name,
  2502.     column_name
  2503. from  system.repcat$_grouped_column
  2504. where sname = USER
  2505. /
  2506. comment on table user_repgrouped_column is
  2507. 'Columns in the all column groups of user''s replicated tables'
  2508. /
  2509. comment on column user_repgrouped_column.oname is
  2510. 'Name of the replicated table'
  2511. /
  2512. comment on column user_repgrouped_column.group_name is
  2513. 'Name of the column group'
  2514. /
  2515. comment on column user_repgrouped_column.column_name is
  2516. 'Name of the column in the column group'
  2517. /
  2518. drop public synonym user_repgrouped_column
  2519. /
  2520. create public synonym user_repgrouped_column for user_repgrouped_column
  2521. /
  2522. grant select on user_repgrouped_column to public with grant option
  2523. /
  2524.  
  2525.  
  2526.  
  2527.  
  2528. create table system.repcat$_conflict
  2529. (
  2530.     sname                  varchar2(30),
  2531.     oname                  varchar2(30),
  2532.     conflict_type_id       integer
  2533.                                constraint repcat$_conflict_c1
  2534.                                  check (conflict_type_id in (1, 2, 3)),
  2535.     reference_name         varchar2(30),
  2536.         constraint repcat$_conflict_pk
  2537.           primary key (sname,
  2538.                        oname,
  2539.                        conflict_type_id,
  2540.                        reference_name)
  2541. )
  2542. /
  2543. comment on table system.repcat$_conflict is
  2544. 'All conflicts for which users have specified resolutions in the database'
  2545. /
  2546. comment on column system.repcat$_conflict.sname is
  2547. 'Name of the replicated schema'
  2548. /
  2549. comment on column system.repcat$_conflict.oname is
  2550. 'Name of the replicated table'
  2551. /
  2552. comment on column system.repcat$_conflict.conflict_type_id is
  2553. 'Type of conflict'
  2554. /
  2555. comment on column system.repcat$_conflict.reference_name is
  2556. 'Table name, unique constraint name, or column group name'
  2557. /
  2558.  
  2559.  
  2560.  
  2561.  
  2562. create or replace view dba_repconflict
  2563. (
  2564.     sname,
  2565.     oname,
  2566.     conflict_type,
  2567.     reference_name
  2568. )
  2569. as
  2570. select
  2571.     sname,
  2572.     oname,
  2573.     decode(conflict_type_id,
  2574.            1, 'UPDATE',
  2575.            2, 'UNIQUENESS',
  2576.            3, 'DELETE',
  2577.            'UNDEFINED'),
  2578.     reference_name
  2579. from  system.repcat$_conflict
  2580. /
  2581. comment on table dba_repconflict is
  2582. 'All conflicts for which users have specified resolutions in the database'
  2583. /
  2584. comment on column dba_repconflict.sname is
  2585. 'Name of the replicated schema'
  2586. /
  2587. comment on column dba_repconflict.oname is
  2588. 'Name of the replicated table'
  2589. /
  2590. comment on column dba_repconflict.conflict_type is
  2591. 'Type of conflict'
  2592. /
  2593. comment on column dba_repconflict.reference_name is
  2594. 'Table name, unique constraint name, or column group name'
  2595. /
  2596.  
  2597.  
  2598.  
  2599.  
  2600. create or replace view all_repconflict
  2601. (
  2602.     sname,
  2603.     oname,
  2604.     conflict_type,
  2605.     reference_name
  2606. )
  2607. as
  2608. select
  2609.     sname,
  2610.     oname,
  2611.     decode(conflict_type_id,
  2612.            1, 'UPDATE',
  2613.            2, 'UNIQUENESS',
  2614.            3, 'DELETE',
  2615.            'UNDEFINED'),
  2616.     reference_name
  2617. from  system.repcat$_conflict,
  2618.       sys.user$ u, sys.obj$ o
  2619. where sname = u.name
  2620.   and oname = o.name
  2621.   and o.owner# = u.user#
  2622.   and o.type = 2 /* tables */
  2623.   and (o.owner# = userenv('SCHEMAID')
  2624.         or
  2625.        o.obj# in ( select obj#
  2626.                    from objauth$
  2627.                    where grantee# in ( select kzsrorol
  2628.                                        from x$kzsro
  2629.                                      )
  2630.                   )
  2631.         or
  2632.      exists (select null from v$enabledprivs
  2633.              where priv_number in (-45 /* LOCK ANY TABLE */,
  2634.                        -47 /* SELECT ANY TABLE */,
  2635.                        -48 /* INSERT ANY TABLE */,
  2636.                        -49 /* UPDATE ANY TABLE */,
  2637.                        -50 /* DELETE ANY TABLE */)
  2638.                  )
  2639.        )
  2640. /
  2641. comment on table all_repconflict is
  2642. 'All conflicts with available resolutions for replicated tables which are accessible to the user'
  2643. /
  2644. comment on column all_repconflict.sname is
  2645. 'Name of the replicated schema'
  2646. /
  2647. comment on column all_repconflict.oname is
  2648. 'Name of the replicated table'
  2649. /
  2650. comment on column all_repconflict.conflict_type is
  2651. 'Type of conflict'
  2652. /
  2653. comment on column all_repconflict.reference_name is
  2654. 'Table name, unique constraint name, or column group name'
  2655. /
  2656. drop public synonym all_repconflict
  2657. /
  2658. create public synonym all_repconflict for all_repconflict
  2659. /
  2660. grant select on all_repconflict to public with grant option
  2661. /
  2662.  
  2663.  
  2664.  
  2665.  
  2666. create or replace view user_repconflict
  2667. (
  2668.     oname,
  2669.     conflict_type,
  2670.     reference_name
  2671. )
  2672. as
  2673. select
  2674.     oname,
  2675.     decode(conflict_type_id,
  2676.            1, 'UPDATE',
  2677.            2, 'UNIQUENESS',
  2678.            3, 'DELETE',
  2679.            'UNDEFINED'),
  2680.     reference_name
  2681. from  system.repcat$_conflict
  2682. where sname = USER
  2683. /
  2684. comment on table all_repconflict is
  2685. 'All conflicts with available resolutions for user''s replicated tables'
  2686. /
  2687. comment on column all_repconflict.oname is
  2688. 'Name of the replicated table'
  2689. /
  2690. comment on column all_repconflict.conflict_type is
  2691. 'Type of conflict'
  2692. /
  2693. comment on column all_repconflict.reference_name is
  2694. 'Table name, unique constraint name, or column group name'
  2695. /
  2696. drop public synonym user_repconflict
  2697. /
  2698. create public synonym user_repconflict for user_repconflict
  2699. /
  2700. grant select on user_repconflict to public with grant option
  2701. /
  2702.  
  2703.  
  2704.  
  2705.  
  2706. create table system.repcat$_resolution_method
  2707. (
  2708.     conflict_type_id       integer,
  2709.     method_name            varchar2(80),
  2710.         constraint repcat$_resol_method_pk
  2711.           primary key (conflict_type_id, method_name)
  2712. )
  2713. /
  2714. comment on table system.repcat$_resolution_method is
  2715. 'All conflict resolution methods in the database'
  2716. /
  2717. comment on column system.repcat$_resolution_method.conflict_type_id is
  2718. 'Type of conflict'
  2719. /
  2720. comment on column system.repcat$_resolution_method.method_name is
  2721. 'Name of the conflict resolution method'
  2722. /
  2723.  
  2724.  
  2725.  
  2726.  
  2727. create or replace view dba_represolution_method
  2728. (
  2729.     conflict_type,
  2730.     method_name
  2731. )
  2732. as
  2733. select
  2734.     decode(conflict_type_id,
  2735.            1, 'UPDATE',
  2736.            2, 'UNIQUENESS',
  2737.            3, 'DELETE',
  2738.            'UNDEFINED'),
  2739.     method_name
  2740. from  system.repcat$_resolution_method
  2741. /
  2742. comment on table dba_represolution_method is
  2743. 'All conflict resolution methods in the database'
  2744. /
  2745. comment on column dba_represolution_method.conflict_type is
  2746. 'Type of conflict'
  2747. /
  2748. comment on column dba_represolution_method.method_name is
  2749. 'Name of the conflict resolution method'
  2750. /
  2751.  
  2752.  
  2753.  
  2754.  
  2755. create or replace view all_represolution_method
  2756. (
  2757.     conflict_type,
  2758.     method_name
  2759. )
  2760. as
  2761. select
  2762.     decode(conflict_type_id,
  2763.            1, 'UPDATE',
  2764.            2, 'UNIQUENESS',
  2765.            3, 'DELETE',
  2766.            'UNDEFINED'),
  2767.     method_name
  2768. from  system.repcat$_resolution_method
  2769. /
  2770. comment on table all_represolution_method is
  2771. 'All conflict resolution methods accessible to the user'
  2772. /
  2773. comment on column all_represolution_method.conflict_type is
  2774. 'Type of conflict'
  2775. /
  2776. comment on column all_represolution_method.method_name is
  2777. 'Name of the conflict resolution method'
  2778. /
  2779. drop public synonym all_represolution_method
  2780. /
  2781. create public synonym all_represolution_method for all_represolution_method
  2782. /
  2783. grant select on all_represolution_method to public with grant option
  2784. /
  2785.  
  2786.  
  2787.  
  2788.  
  2789. create or replace view user_represolution_method
  2790. (
  2791.     conflict_type,
  2792.     method_name
  2793. )
  2794. as
  2795. select
  2796.     decode(conflict_type_id,
  2797.            1, 'UPDATE',
  2798.            2, 'UNIQUENESS',
  2799.            3, 'DELETE',
  2800.            'UNDEFINED'),
  2801.     method_name
  2802. from  system.repcat$_resolution_method
  2803. /
  2804. comment on table user_represolution_method is
  2805. 'All conflict resolution methods accessible to the user'
  2806. /
  2807. comment on column user_represolution_method.conflict_type is
  2808. 'Type of conflict'
  2809. /
  2810. comment on column user_represolution_method.method_name is
  2811. 'Name of the conflict resolution method'
  2812. /
  2813. drop public synonym user_represolution_method
  2814. /
  2815. create public synonym user_represolution_method for user_represolution_method
  2816. /
  2817. grant select on user_represolution_method to public with grant option
  2818. /
  2819.  
  2820.  
  2821.  
  2822.  
  2823. create table system.repcat$_resolution
  2824. (
  2825.     sname                  varchar2(30),
  2826.     oname                  varchar2(30),
  2827.     conflict_type_id       integer,
  2828.     reference_name         varchar2(30),
  2829.     sequence_no            number,
  2830.     method_name            varchar2(80)
  2831.                                constraint repcat$_resolution_nn1
  2832.                                  not null,
  2833.     function_name          varchar2(92)
  2834.                                constraint repcat$_resolution_nn2
  2835.                                  not null,
  2836.     priority_group         varchar2(30),
  2837.     resolution_comment     varchar2(80),
  2838.         constraint repcat$_resolution_pk
  2839.           primary key (sname,
  2840.                        oname,
  2841.                        conflict_type_id,
  2842.                        reference_name,
  2843.                        sequence_no),
  2844.         constraint repcat$_resolution_f1
  2845.           foreign key (conflict_type_id,
  2846.                        method_name)
  2847.           references system.repcat$_resolution_method,
  2848.         constraint repcat$_resolution_f2
  2849.           foreign key (priority_group, sname)
  2850.           references system.repcat$_priority_group,
  2851.         constraint repcat$_resolution_f3
  2852.           foreign key (sname,
  2853.                        oname,
  2854.                        conflict_type_id,
  2855.                        reference_name)
  2856.           references system.repcat$_conflict
  2857. )
  2858. /
  2859. comment on table system.repcat$_resolution is
  2860. 'Description of all conflict resolutions in the database'
  2861. /
  2862. comment on column system.repcat$_resolution.sname is
  2863. 'Name of the replicated schema'
  2864. /
  2865. comment on column system.repcat$_resolution.oname is
  2866. 'Name of the replicated table'
  2867. /
  2868. comment on column system.repcat$_resolution.conflict_type_id is
  2869. 'Type of conflict'
  2870. /
  2871. comment on column system.repcat$_resolution.reference_name is
  2872. 'Table name, unique constraint name, or column group name'
  2873. /
  2874. comment on column system.repcat$_resolution.sequence_no is
  2875. 'Ordering on resolution'
  2876. /
  2877. comment on column system.repcat$_resolution.method_name is
  2878. 'Name of the conflict resolution method'
  2879. /
  2880. comment on column system.repcat$_resolution.function_name is
  2881. 'Name of the resolution function'
  2882. /
  2883. comment on column system.repcat$_resolution.priority_group is
  2884. 'Name of the priority group used in conflict resolution'
  2885. /
  2886. comment on column system.repcat$_resolution.resolution_comment is
  2887. 'Description of the conflict resolution'
  2888. /
  2889.  
  2890.  
  2891.  
  2892.  
  2893. create or replace view dba_represolution
  2894. (
  2895.     sname,
  2896.     oname,
  2897.     conflict_type,
  2898.     reference_name,
  2899.     sequence_no,
  2900.     method_name,
  2901.     function_name,
  2902.     priority_group,
  2903.     resolution_comment
  2904. )
  2905. as
  2906. select
  2907.     sname,
  2908.     oname,
  2909.     decode(conflict_type_id,
  2910.            1, 'UPDATE',
  2911.            2, 'UNIQUENESS',
  2912.            3, 'DELETE',
  2913.            'UNDEFINED'),
  2914.     reference_name,
  2915.     sequence_no,
  2916.     method_name,
  2917.     decode(method_name, 'USER FUNCTION', function_name, NULL),
  2918.     priority_group,
  2919.     resolution_comment
  2920. from  system.repcat$_resolution
  2921. /
  2922. comment on table dba_represolution is
  2923. 'Description of all conflict resolutions in the database'
  2924. /
  2925. comment on column dba_represolution.sname is
  2926. 'Name of the replicated schema'
  2927. /
  2928. comment on column dba_represolution.oname is
  2929. 'Name of the replicated table'
  2930. /
  2931. comment on column dba_represolution.conflict_type is
  2932. 'Type of conflict'
  2933. /
  2934. comment on column dba_represolution.reference_name is
  2935. 'Table name, unique constraint name, or column group name'
  2936. /
  2937. comment on column dba_represolution.sequence_no is
  2938. 'Ordering on resolution'
  2939. /
  2940. comment on column dba_represolution.method_name is
  2941. 'Name of the conflict resolution method'
  2942. /
  2943. comment on column dba_represolution.function_name is
  2944. 'Name of the resolution function'
  2945. /
  2946. comment on column dba_represolution.priority_group is
  2947. 'Name of the priority group used in conflict resolution'
  2948. /
  2949. comment on column dba_represolution.resolution_comment is
  2950. 'Description of the conflict resolution'
  2951. /
  2952.  
  2953.  
  2954.  
  2955.  
  2956. create or replace view all_represolution
  2957. (
  2958.     sname,
  2959.     oname,
  2960.     conflict_type,
  2961.     reference_name,
  2962.     sequence_no,
  2963.     method_name,
  2964.     function_name,
  2965.     priority_group,
  2966.     resolution_comment
  2967. )
  2968. as
  2969. select
  2970.     sname,
  2971.     oname,
  2972.     decode(conflict_type_id,
  2973.            1, 'UPDATE',
  2974.            2, 'UNIQUENESS',
  2975.            3, 'DELETE',
  2976.            'UNDEFINED'),
  2977.     reference_name,
  2978.     sequence_no,
  2979.     method_name,
  2980.     decode(method_name, 'USER FUNCTION', function_name, NULL),
  2981.     priority_group,
  2982.     resolution_comment
  2983. from  system.repcat$_resolution,
  2984.       sys.user$ u, sys.obj$ o
  2985. where sname = u.name
  2986.   and oname = o.name
  2987.   and o.owner# = u.user#
  2988.   and o.type = 2 /* tables */
  2989.   and (o.owner# = userenv('SCHEMAID')
  2990.         or
  2991.        o.obj# in ( select obj#
  2992.                    from objauth$
  2993.                    where grantee# in ( select kzsrorol
  2994.                                        from x$kzsro
  2995.                                      )
  2996.                   )
  2997.         or
  2998.      exists (select null from v$enabledprivs
  2999.              where priv_number in (-45 /* LOCK ANY TABLE */,
  3000.                        -47 /* SELECT ANY TABLE */,
  3001.                        -48 /* INSERT ANY TABLE */,
  3002.                        -49 /* UPDATE ANY TABLE */,
  3003.                        -50 /* DELETE ANY TABLE */)
  3004.                  )
  3005.        )
  3006. /
  3007. comment on table all_represolution is
  3008. 'Description of all conflict resolutions for replicated tables which are accessible to the user'
  3009. /
  3010. comment on column all_represolution.sname is
  3011. 'Name of the replicated schema'
  3012. /
  3013. comment on column all_represolution.oname is
  3014. 'Name of the replicated table'
  3015. /
  3016. comment on column all_represolution.conflict_type is
  3017. 'Type of conflict'
  3018. /
  3019. comment on column all_represolution.reference_name is
  3020. 'Table name, unique constraint name, or column group name'
  3021. /
  3022. comment on column all_represolution.sequence_no is
  3023. 'Ordering on resolution'
  3024. /
  3025. comment on column all_represolution.method_name is
  3026. 'Name of the conflict resolution method'
  3027. /
  3028. comment on column all_represolution.function_name is
  3029. 'Name of the resolution function'
  3030. /
  3031. comment on column all_represolution.priority_group is
  3032. 'Name of the priority group used in conflict resolution'
  3033. /
  3034. comment on column all_represolution.resolution_comment is
  3035. 'Description of the conflict resolution'
  3036. /
  3037. drop public synonym all_represolution
  3038. /
  3039. create public synonym all_represolution for all_represolution
  3040. /
  3041. grant select on all_represolution to public with grant option
  3042. /
  3043.  
  3044.  
  3045.  
  3046.  
  3047. create or replace view user_represolution
  3048. (
  3049.     oname,
  3050.     conflict_type,
  3051.     reference_name,
  3052.     sequence_no,
  3053.     method_name,
  3054.     function_name,
  3055.     priority_group,
  3056.     resolution_comment
  3057. )
  3058. as
  3059. select
  3060.     oname,
  3061.     decode(conflict_type_id,
  3062.            1, 'UPDATE',
  3063.            2, 'UNIQUENESS',
  3064.            3, 'DELETE',
  3065.            'UNDEFINED'),
  3066.     reference_name,
  3067.     sequence_no,
  3068.     method_name,
  3069.     decode(method_name, 'USER FUNCTION', function_name, NULL),
  3070.     priority_group,
  3071.     resolution_comment
  3072. from  system.repcat$_resolution
  3073. where sname = USER
  3074. /
  3075. comment on table user_represolution is
  3076. 'Description of all conflict resolutions for user''s replicated tables'
  3077. /
  3078. comment on column user_represolution.oname is
  3079. 'Name of the replicated table'
  3080. /
  3081. comment on column user_represolution.conflict_type is
  3082. 'Type of conflict'
  3083. /
  3084. comment on column user_represolution.reference_name is
  3085. 'Table name, unique constraint name, or column group name'
  3086. /
  3087. comment on column user_represolution.sequence_no is
  3088. 'Ordering on resolution'
  3089. /
  3090. comment on column user_represolution.method_name is
  3091. 'Name of the conflict resolution method'
  3092. /
  3093. comment on column user_represolution.function_name is
  3094. 'Name of the resolution function'
  3095. /
  3096. comment on column user_represolution.priority_group is
  3097. 'Name of the priority group used in conflict resolution'
  3098. /
  3099. comment on column user_represolution.resolution_comment is
  3100. 'Description of the conflict resolution'
  3101. /
  3102. drop public synonym user_represolution
  3103. /
  3104. create public synonym user_represolution for user_represolution
  3105. /
  3106. grant select on user_represolution to public with grant option
  3107. /
  3108.  
  3109.  
  3110.  
  3111.  
  3112. create table system.repcat$_resolution_statistics
  3113. (
  3114.     sname                  varchar2(30)
  3115.                                constraint repcat$_resolution_stats_nn1
  3116.                                  not null,
  3117.     oname                  varchar2(30)
  3118.                                constraint repcat$_resolution_stats_nn2
  3119.                                  not null,
  3120.     conflict_type_id       integer
  3121.                                constraint repcat$_resolution_stats_nn3
  3122.                                  not null,
  3123.     reference_name         varchar2(30)
  3124.                                constraint repcat$_resolution_stats_nn4
  3125.                                  not null,
  3126.     method_name            varchar2(80)
  3127.                                constraint repcat$_resolution_stats_nn5
  3128.                                  not null,
  3129.     function_name          varchar2(92)
  3130.                                constraint repcat$_resolution_stats_nn6
  3131.                                  not null,
  3132.     priority_group         varchar2(30),
  3133.     resolved_date          date
  3134.                                constraint repcat$_resolution_stats_nn7
  3135.                                  not null,
  3136.     primary_key_value      varchar2(2000)
  3137.                                constraint repcat$_resolution_stats_nn8
  3138.                                  not null
  3139. )
  3140. /
  3141. comment on table system.repcat$_resolution_statistics is
  3142. 'Statistics for conflict resolutions for all replicated tables in the database'
  3143. /
  3144. comment on column system.repcat$_resolution_statistics.sname is
  3145. 'Name of the replicated schema'
  3146. /
  3147. comment on column system.repcat$_resolution_statistics.oname is
  3148. 'Name of the replicated table'
  3149. /
  3150. comment on column system.repcat$_resolution_statistics.conflict_type_id is
  3151. 'Type of conflict'
  3152. /
  3153. comment on column system.repcat$_resolution_statistics.reference_name is
  3154. 'Table name, unique constraint name, or column group name'
  3155. /
  3156. comment on column system.repcat$_resolution_statistics.method_name is
  3157. 'Name of the conflict resolution method'
  3158. /
  3159. comment on column system.repcat$_resolution_statistics.function_name is
  3160. 'Name of the resolution function'
  3161. /
  3162. comment on column system.repcat$_resolution_statistics.priority_group is
  3163. 'Name of the priority group used in conflict resolution'
  3164. /
  3165. comment on column system.repcat$_resolution_statistics.resolved_date is
  3166. 'Timestamp for the resolution of the conflict'
  3167. /
  3168. comment on column system.repcat$_resolution_statistics.primary_key_value is
  3169. 'Primary key of the replicated row (character data)'
  3170. /
  3171.  
  3172.  
  3173.  
  3174.  
  3175. create or replace view dba_represolution_statistics
  3176. (
  3177.     sname,
  3178.     oname,
  3179.     conflict_type,
  3180.     reference_name,
  3181.     method_name,
  3182.     function_name,
  3183.     priority_group,
  3184.     resolved_date,
  3185.     primary_key_value
  3186. )
  3187. as
  3188. select
  3189.     sname,
  3190.     oname,
  3191.     decode(conflict_type_id,
  3192.            1, 'UPDATE',
  3193.            2, 'UNIQUENESS',
  3194.            3, 'DELETE',
  3195.            'UNDEFINED'),
  3196.     reference_name,
  3197.     method_name,
  3198.     decode(method_name, 'USER FUNCTION', function_name, NULL),
  3199.     priority_group,
  3200.     resolved_date,
  3201.     primary_key_value
  3202. from  system.repcat$_resolution_statistics
  3203. /
  3204. comment on table dba_represolution_statistics is
  3205. 'Statistics for conflict resolutions for all replicated tables in the database'
  3206. /
  3207. comment on column dba_represolution_statistics.sname is
  3208. 'Name of the replicated schema'
  3209. /
  3210. comment on column dba_represolution_statistics.oname is
  3211. 'Name of the replicated table'
  3212. /
  3213. comment on column dba_represolution_statistics.conflict_type is
  3214. 'Type of conflict'
  3215. /
  3216. comment on column dba_represolution_statistics.reference_name is
  3217. 'Table name, unique constraint name, or column group name'
  3218. /
  3219. comment on column dba_represolution_statistics.method_name is
  3220. 'Name of the conflict resolution method'
  3221. /
  3222. comment on column dba_represolution_statistics.function_name is
  3223. 'Name of the resolution function'
  3224. /
  3225. comment on column dba_represolution_statistics.priority_group is
  3226. 'Name of the priority group used in conflict resolution'
  3227. /
  3228. comment on column dba_represolution_statistics.resolved_date is
  3229. 'Timestamp for the resolution of the conflict'
  3230. /
  3231. comment on column dba_represolution_statistics.primary_key_value is
  3232. 'Primary key of the replicated row (character data)'
  3233. /
  3234.  
  3235.  
  3236.  
  3237.  
  3238. create or replace view all_represolution_statistics
  3239. (
  3240.     sname,
  3241.     oname,
  3242.     conflict_type,
  3243.     reference_name,
  3244.     method_name,
  3245.     function_name,
  3246.     priority_group,
  3247.     resolved_date,
  3248.     primary_key_value
  3249. )
  3250. as
  3251. select
  3252.     sname,
  3253.     oname,
  3254.     decode(conflict_type_id,
  3255.            1, 'UPDATE',
  3256.            2, 'UNIQUENESS',
  3257.            3, 'DELETE',
  3258.            'UNDEFINED'),
  3259.     reference_name,
  3260.     method_name,
  3261.     decode(method_name, 'USER FUNCTION', function_name, NULL),
  3262.     priority_group,
  3263.     resolved_date,
  3264.     primary_key_value
  3265. from  system.repcat$_resolution_statistics,
  3266.       sys.user$ u, sys.obj$ o
  3267. where sname = u.name
  3268.   and oname = o.name
  3269.   and o.owner# = u.user#
  3270.   and o.type = 2 /* tables */
  3271.   and (o.owner# = userenv('SCHEMAID')
  3272.         or
  3273.        o.obj# in ( select obj#
  3274.                    from objauth$
  3275.                    where grantee# in ( select kzsrorol
  3276.                                        from x$kzsro
  3277.                                      )
  3278.                   )
  3279.         or
  3280.      exists (select null from v$enabledprivs
  3281.              where priv_number in (-45 /* LOCK ANY TABLE */,
  3282.                        -47 /* SELECT ANY TABLE */,
  3283.                        -48 /* INSERT ANY TABLE */,
  3284.                        -49 /* UPDATE ANY TABLE */,
  3285.                        -50 /* DELETE ANY TABLE */)
  3286.                  )
  3287.        )
  3288. /
  3289. comment on table all_represolution_statistics is
  3290. 'Statistics for conflict resolutions for replicated tables which are accessible to the user'
  3291. /
  3292. comment on column all_represolution_statistics.sname is
  3293. 'Name of the replicated schema'
  3294. /
  3295. comment on column all_represolution_statistics.oname is
  3296. 'Name of the replicated table'
  3297. /
  3298. comment on column all_represolution_statistics.conflict_type is
  3299. 'Type of conflict'
  3300. /
  3301. comment on column all_represolution_statistics.reference_name is
  3302. 'Table name, unique constraint name, or column group name'
  3303. /
  3304. comment on column all_represolution_statistics.method_name is
  3305. 'Name of the conflict resolution method'
  3306. /
  3307. comment on column all_represolution_statistics.function_name is
  3308. 'Name of the resolution function'
  3309. /
  3310. comment on column all_represolution_statistics.priority_group is
  3311. 'Name of the priority group used in conflict resolution'
  3312. /
  3313. comment on column all_represolution_statistics.resolved_date is
  3314. 'Timestamp for the resolution of the conflict'
  3315. /
  3316. comment on column all_represolution_statistics.primary_key_value is
  3317. 'Primary key of the replicated row (character data)'
  3318. /
  3319. drop public synonym all_represolution_statistics
  3320. /
  3321. create public synonym all_represolution_statistics for
  3322.   all_represolution_statistics
  3323. /
  3324. grant select on all_represolution_statistics to public with grant option
  3325. /
  3326.  
  3327.  
  3328.  
  3329.  
  3330. create or replace view user_represolution_statistics
  3331. (
  3332.     oname,
  3333.     conflict_type,
  3334.     reference_name,
  3335.     method_name,
  3336.     function_name,
  3337.     priority_group,
  3338.     resolved_date,
  3339.     primary_key_value
  3340. )
  3341. as
  3342. select
  3343.     oname,
  3344.     decode(conflict_type_id,
  3345.            1, 'UPDATE',
  3346.            2, 'UNIQUENESS',
  3347.            3, 'DELETE',
  3348.            'UNDEFINED'),
  3349.     reference_name,
  3350.     method_name,
  3351.     decode(method_name, 'USER FUNCTION', function_name, NULL),
  3352.     priority_group,
  3353.     resolved_date,
  3354.     primary_key_value
  3355. from  system.repcat$_resolution_statistics
  3356. where sname = USER
  3357. /
  3358. comment on table user_represolution_statistics is
  3359. 'Statistics for conflict resolutions for user''s replicated tables'
  3360. /
  3361. comment on column user_represolution_statistics.oname is
  3362. 'Name of the replicated table'
  3363. /
  3364. comment on column user_represolution_statistics.conflict_type is
  3365. 'Type of conflict'
  3366. /
  3367. comment on column user_represolution_statistics.reference_name is
  3368. 'Table name, unique constraint name, or column group name'
  3369. /
  3370. comment on column user_represolution_statistics.method_name is
  3371. 'Name of the conflict resolution method'
  3372. /
  3373. comment on column user_represolution_statistics.function_name is
  3374. 'Name of the resolution function'
  3375. /
  3376. comment on column user_represolution_statistics.priority_group is
  3377. 'Name of the priority group used in conflict resolution'
  3378. /
  3379. comment on column user_represolution_statistics.resolved_date is
  3380. 'Timestamp for the resolution of the conflict'
  3381. /
  3382. comment on column user_represolution_statistics.primary_key_value is
  3383. 'Primary key of the replicated row (character data)'
  3384. /
  3385. drop public synonym user_represolution_statistics
  3386. /
  3387. create public synonym user_represolution_statistics for
  3388.   user_represolution_statistics
  3389. /
  3390. grant select on user_represolution_statistics to public with grant option
  3391. /
  3392.  
  3393.  
  3394.  
  3395.  
  3396. CREATE INDEX system.repcat$_resolution_stats_n1 on
  3397.   system.repcat$_resolution_statistics
  3398.   (
  3399.    sname,
  3400.    oname,
  3401.    resolved_date,
  3402.    conflict_type_id,
  3403.    reference_name,
  3404.    method_name,
  3405.    function_name,
  3406.    priority_group
  3407.   )
  3408. /
  3409.  
  3410.  
  3411.  
  3412.  
  3413. create table system.repcat$_resol_stats_control
  3414. (
  3415.     sname                  varchar2(30),
  3416.     oname                  varchar2(30),
  3417.     created                date
  3418.                                constraint repcat$_resol_stats_ctrl_nn1
  3419.                                  not null,
  3420.     status                 integer
  3421.                                constraint repcat$_resol_stats_ctrl_nn2
  3422.                                  not null,
  3423.     status_update_date     date
  3424.                                constraint repcat$_resol_stats_ctrl_nn3
  3425.                                  not null,
  3426.     purged_date             date,
  3427.     last_purge_start_date   date,
  3428.     last_purge_end_date     date,
  3429.         constraint repcat$_resol_stats_ctrl_pk
  3430.           primary key (sname,
  3431.                        oname)
  3432. )
  3433. /
  3434. comment on table system.repcat$_resol_stats_control is
  3435. 'Information about statistics collection for conflict resolutions for all replicated tables in the database'
  3436. /
  3437. comment on column system.repcat$_resol_stats_control.sname is
  3438. 'Name of the replicated schema'
  3439. /
  3440. comment on column system.repcat$_resol_stats_control.oname is
  3441. 'Name of the replicated table'
  3442. /
  3443. comment on column system.repcat$_resol_stats_control.created is
  3444. 'Timestamp for which statistics collection was first started'
  3445. /
  3446. comment on column system.repcat$_resol_stats_control.status is
  3447. 'Status of statistics collection: ACTIVE, CANCELLED'
  3448. /
  3449. comment on column system.repcat$_resol_stats_control.status_update_date is
  3450. 'Timestamp for which the status was last updated'
  3451. /
  3452. comment on column system.repcat$_resol_stats_control.purged_date is
  3453. 'Timestamp for the last purge of statistics data'
  3454. /
  3455. comment on column system.repcat$_resol_stats_control.last_purge_start_date is
  3456. 'The last start date of the statistics purging date range'
  3457. /
  3458. comment on column system.repcat$_resol_stats_control.last_purge_end_date is
  3459. 'The last end date of the statistics purging date range'
  3460. /
  3461.  
  3462.  
  3463.  
  3464.  
  3465. create or replace view dba_represol_stats_control
  3466. (
  3467.     sname,
  3468.     oname,
  3469.     created,
  3470.     status,
  3471.     status_update_date,
  3472.     purged_date,
  3473.     last_purge_start_date,
  3474.     last_purge_end_date
  3475. )
  3476. as
  3477. select
  3478.     sname,
  3479.     oname,
  3480.     created,
  3481.     decode(status,
  3482.            1, 'ACTIVE',
  3483.            2, 'CANCELLED',
  3484.            'UNDEFINED'),
  3485.     status_update_date,
  3486.     purged_date,
  3487.     last_purge_start_date,
  3488.     last_purge_end_date
  3489. from  system.repcat$_resol_stats_control
  3490. /
  3491. comment on table dba_represol_stats_control is
  3492. 'Information about statistics collection for conflict resolutions for all replicated tables in the database'
  3493. /
  3494. comment on column dba_represol_stats_control.sname is
  3495. 'Name of the replicated schema'
  3496. /
  3497. comment on column dba_represol_stats_control.oname is
  3498. 'Name of the replicated table'
  3499. /
  3500. comment on column dba_represol_stats_control.created is
  3501. 'Timestamp for which statistics collection was first started'
  3502. /
  3503. comment on column dba_represol_stats_control.status is
  3504. 'Status of statistics collection: ACTIVE, CANCELLED'
  3505. /
  3506. comment on column dba_represol_stats_control.status_update_date is
  3507. 'Timestamp for which the status was last updated'
  3508. /
  3509. comment on column dba_represol_stats_control.purged_date is
  3510. 'Timestamp for the last purge of statistics data'
  3511. /
  3512. comment on column dba_represol_stats_control.last_purge_start_date is
  3513. 'The last start date of the statistics purging date range'
  3514. /
  3515. comment on column dba_represol_stats_control.last_purge_end_date is
  3516. 'The last end date of the statistics purging date range'
  3517. /
  3518.  
  3519.  
  3520.  
  3521.  
  3522. create or replace view all_represol_stats_control
  3523. (
  3524.     sname,
  3525.     oname,
  3526.     created,
  3527.     status,
  3528.     status_update_date,
  3529.     purged_date,
  3530.     last_purge_start_date,
  3531.     last_purge_end_date
  3532. )
  3533. as
  3534. select
  3535.     c.sname,
  3536.     c.oname,
  3537.     c.created,
  3538.     decode(c.status,
  3539.            1, 'ACTIVE',
  3540.            2, 'CANCELLED',
  3541.            'UNDEFINED'),
  3542.     c.status_update_date,
  3543.     c.purged_date,
  3544.     c.last_purge_start_date,
  3545.     c.last_purge_end_date
  3546. from  system.repcat$_resol_stats_control c,
  3547.       sys.user$ u, sys.obj$ o
  3548. where c.sname = u.name
  3549.   and c.oname = o.name
  3550.   and o.owner# = u.user#
  3551.   and o.type = 2 /* tables */
  3552.   and (o.owner# = userenv('SCHEMAID')
  3553.         or
  3554.        o.obj# in ( select obj#
  3555.                    from objauth$
  3556.                    where grantee# in ( select kzsrorol
  3557.                                        from x$kzsro
  3558.                                      )
  3559.                   )
  3560.         or
  3561.      exists (select null from v$enabledprivs
  3562.              where priv_number in (-45 /* LOCK ANY TABLE */,
  3563.                        -47 /* SELECT ANY TABLE */,
  3564.                        -48 /* INSERT ANY TABLE */,
  3565.                        -49 /* UPDATE ANY TABLE */,
  3566.                        -50 /* DELETE ANY TABLE */)
  3567.                  )
  3568.        )
  3569. /
  3570. comment on table all_represol_stats_control is
  3571. 'Information about statistics collection for conflict resolutions for replicated tables which are accessible to the user'
  3572. /
  3573. comment on column all_represol_stats_control.sname is
  3574. 'Name of the replicated schema'
  3575. /
  3576. comment on column all_represol_stats_control.oname is
  3577. 'Name of the replicated table'
  3578. /
  3579. comment on column all_represol_stats_control.created is
  3580. 'Timestamp for which statistics collection was first started'
  3581. /
  3582. comment on column all_represol_stats_control.status is
  3583. 'Status of statistics collection: ACTIVE, CANCELLED'
  3584. /
  3585. comment on column all_represol_stats_control.status_update_date is
  3586. 'Timestamp for which the status was last updated'
  3587. /
  3588. comment on column all_represol_stats_control.purged_date is
  3589. 'Timestamp for the last purge of statistics data'
  3590. /
  3591. comment on column all_represol_stats_control.last_purge_start_date is
  3592. 'The last start date of the statistics purging date range'
  3593. /
  3594. comment on column all_represol_stats_control.last_purge_end_date is
  3595. 'The last end date of the statistics purging date range'
  3596. /
  3597. drop public synonym all_represol_stats_control
  3598. /
  3599. create public synonym all_represol_stats_control for
  3600.   all_represol_stats_control
  3601. /
  3602. grant select on all_represol_stats_control to public with grant option
  3603. /
  3604.  
  3605.  
  3606.  
  3607.  
  3608. create or replace view user_represol_stats_control
  3609. (
  3610.     oname,
  3611.     created,
  3612.     status,
  3613.     status_update_date,
  3614.     purged_date,
  3615.     last_purge_start_date,
  3616.     last_purge_end_date
  3617. )
  3618. as
  3619. select
  3620.     oname,
  3621.     created,
  3622.     decode(status,
  3623.            1, 'ACTIVE',
  3624.            2, 'CANCELLED',
  3625.            'UNDEFINED'),
  3626.     status_update_date,
  3627.     purged_date,
  3628.     last_purge_start_date,
  3629.     last_purge_end_date
  3630. from  system.repcat$_resol_stats_control
  3631. where sname = USER
  3632. /
  3633. comment on table user_represol_stats_control is
  3634. 'Information about statistics collection for conflict resolutions for user''s replicated tables'
  3635. /
  3636. comment on column user_represol_stats_control.oname is
  3637. 'Name of the replicated table'
  3638. /
  3639. comment on column user_represol_stats_control.created is
  3640. 'Timestamp for which statistics collection was first started'
  3641. /
  3642. comment on column user_represol_stats_control.status is
  3643. 'Status of statistics collection: ACTIVE, CANCELLED'
  3644. /
  3645. comment on column user_represol_stats_control.status_update_date is
  3646. 'Timestamp for which the status was last updated'
  3647. /
  3648. comment on column user_represol_stats_control.purged_date is
  3649. 'Timestamp for the last purge of statistics data'
  3650. /
  3651. comment on column user_represol_stats_control.last_purge_start_date is
  3652. 'The last start date of the statistics purging date range'
  3653. /
  3654. comment on column user_represol_stats_control.last_purge_end_date is
  3655. 'The last end date of the statistics purging date range'
  3656. /
  3657. drop public synonym user_represol_stats_control
  3658. /
  3659. create public synonym user_represol_stats_control for
  3660.   user_represol_stats_control
  3661. /
  3662. grant select on user_represol_stats_control to public with grant option
  3663. /
  3664.  
  3665.  
  3666.  
  3667.  
  3668. create table system.repcat$_parameter_column
  3669. (
  3670.     sname                  varchar2(30),
  3671.     oname                  varchar2(30),
  3672.     conflict_type_id       integer,
  3673.     reference_name         varchar2(30),
  3674.     sequence_no            number,
  3675.     parameter_table_name   varchar2(30),
  3676.     parameter_column_name  varchar2(30),
  3677.     parameter_sequence_no  number,
  3678.         constraint repcat$_parameter_column_pk
  3679.           primary key (sname,
  3680.                        oname,
  3681.                        conflict_type_id,
  3682.                        reference_name,
  3683.                        sequence_no,
  3684.                        parameter_table_name,
  3685.                        parameter_column_name,
  3686.                        parameter_sequence_no),
  3687.         constraint repcat$_parameter_column_f1
  3688.           foreign key (sname,
  3689.                        oname,
  3690.                        conflict_type_id,
  3691.                        reference_name,
  3692.                        sequence_no)
  3693.           references system.repcat$_resolution
  3694. )
  3695. /
  3696. comment on table system.repcat$_parameter_column is
  3697. 'All columns used for resolving conflicts in the database'
  3698. /
  3699. comment on column system.repcat$_parameter_column.sname is
  3700. 'Name of the replicated schema'
  3701. /
  3702. comment on column system.repcat$_parameter_column.oname is
  3703. 'Name of the replicated table'
  3704. /
  3705. comment on column system.repcat$_parameter_column.conflict_type_id is
  3706. 'Type of conflict'
  3707. /
  3708. comment on column system.repcat$_parameter_column.reference_name is
  3709. 'Table name, unique constraint name, or column group name'
  3710. /
  3711. comment on column system.repcat$_parameter_column.sequence_no is
  3712. 'Ordering on resolution'
  3713. /
  3714. comment on column system.repcat$_parameter_column.parameter_table_name is
  3715. 'Name of the table to which the parameter column belongs'
  3716. /
  3717. comment on column system.repcat$_parameter_column.parameter_column_name is
  3718. 'Name of the parameter column used for resolving the conflict'
  3719. /
  3720. comment on column system.repcat$_parameter_column.parameter_sequence_no is
  3721. 'Ordering on parameter column'
  3722. /
  3723.  
  3724.  
  3725.  
  3726.  
  3727. create or replace view dba_repparameter_column
  3728. (
  3729.     sname,
  3730.     oname,
  3731.     conflict_type,
  3732.     reference_name,
  3733.     sequence_no,
  3734.     method_name,
  3735.     function_name,
  3736.     priority_group,
  3737.     parameter_table_name,
  3738.     parameter_column_name,
  3739.     parameter_sequence_no
  3740. )
  3741. as
  3742. select
  3743.     p.sname,
  3744.     p.oname,
  3745.     decode(p.conflict_type_id,
  3746.            1, 'UPDATE',
  3747.            2, 'UNIQUENESS',
  3748.            3, 'DELETE',
  3749.            'UNDEFINED'),
  3750.     p.reference_name,
  3751.     p.sequence_no,
  3752.     r.method_name,
  3753.     r.function_name,
  3754.     r.priority_group,
  3755.     p.parameter_table_name,
  3756.     p.parameter_column_name,
  3757.     p.parameter_sequence_no
  3758. from  system.repcat$_parameter_column p,
  3759.       system.repcat$_resolution r
  3760. where p.sname = r.sname
  3761. and   p.oname = r.oname
  3762. and   p.conflict_type_id = r.conflict_type_id
  3763. and   p.reference_name = r.reference_name
  3764. and   p.sequence_no = r.sequence_no
  3765. and   p.oname = p.parameter_table_name
  3766. /
  3767. comment on table dba_repparameter_column is
  3768. 'All columns used for resolving conflicts in the database'
  3769. /
  3770. comment on column dba_repparameter_column.sname is
  3771. 'Name of the replicated schema'
  3772. /
  3773. comment on column dba_repparameter_column.oname is
  3774. 'Name of the replicated table'
  3775. /
  3776. comment on column dba_repparameter_column.conflict_type is
  3777. 'Type of conflict'
  3778. /
  3779. comment on column dba_repparameter_column.reference_name is
  3780. 'Table name, unique constraint name, or column group name'
  3781. /
  3782. comment on column dba_repparameter_column.sequence_no is
  3783. 'Ordering on resolution'
  3784. /
  3785. comment on column dba_repparameter_column.parameter_table_name is
  3786. 'Name of the table to which the parameter column belongs'
  3787. /
  3788. comment on column dba_repparameter_column.parameter_column_name is
  3789. 'Name of the parameter column used for resolving the conflict'
  3790. /
  3791. comment on column dba_repparameter_column.parameter_sequence_no is
  3792. 'Ordering on parameter column'
  3793. /
  3794.  
  3795.  
  3796.  
  3797.  
  3798. create or replace view all_repparameter_column
  3799. (
  3800.     sname,
  3801.     oname,
  3802.     conflict_type,
  3803.     reference_name,
  3804.     sequence_no,
  3805.     method_name,
  3806.     function_name,
  3807.     priority_group,
  3808.     parameter_table_name,
  3809.     parameter_column_name,
  3810.     parameter_sequence_no
  3811. )
  3812. as
  3813. select
  3814.     p.sname,
  3815.     p.oname,
  3816.     decode(p.conflict_type_id,
  3817.            1, 'UPDATE',
  3818.            2, 'UNIQUENESS',
  3819.            3, 'DELETE',
  3820.            'UNDEFINED'),
  3821.     p.reference_name,
  3822.     p.sequence_no,
  3823.     r.method_name,
  3824.     r.function_name,
  3825.     r.priority_group,
  3826.     p.parameter_table_name,
  3827.     p.parameter_column_name,
  3828.     p.parameter_sequence_no
  3829. from  system.repcat$_parameter_column p,
  3830.       system.repcat$_resolution r,
  3831.       sys.user$ u, sys.obj$ o
  3832. where p.sname = r.sname
  3833.   and p.oname = r.oname
  3834.   and p.conflict_type_id = r.conflict_type_id
  3835.   and p.reference_name = r.reference_name
  3836.   and p.sequence_no = r.sequence_no
  3837.   and p.oname = p.parameter_table_name
  3838.   and p.sname = u.name
  3839.   and p.oname = o.name
  3840.   and o.owner# = u.user#
  3841.   and o.type = 2 /* tables */
  3842.   and (o.owner# = userenv('SCHEMAID')
  3843.         or
  3844.        o.obj# in ( select obj#
  3845.                    from objauth$
  3846.                    where grantee# in ( select kzsrorol
  3847.                                        from x$kzsro
  3848.                                      )
  3849.                   )
  3850.         or
  3851.      exists (select null from v$enabledprivs
  3852.              where priv_number in (-45 /* LOCK ANY TABLE */,
  3853.                        -47 /* SELECT ANY TABLE */,
  3854.                        -48 /* INSERT ANY TABLE */,
  3855.                        -49 /* UPDATE ANY TABLE */,
  3856.                        -50 /* DELETE ANY TABLE */)
  3857.                  )
  3858.        )
  3859. /
  3860. comment on table all_repparameter_column is
  3861. 'All columns used for resolving conflicts in replicated tables which are accessible to the user'
  3862. /
  3863. comment on column all_repparameter_column.sname is
  3864. 'Name of the replicated schema'
  3865. /
  3866. comment on column all_repparameter_column.oname is
  3867. 'Name of the replicated table'
  3868. /
  3869. comment on column all_repparameter_column.conflict_type is
  3870. 'Type of conflict'
  3871. /
  3872. comment on column all_repparameter_column.reference_name is
  3873. 'Table name, unique constraint name, or column group name'
  3874. /
  3875. comment on column all_repparameter_column.sequence_no is
  3876. 'Ordering on resolution'
  3877. /
  3878. comment on column all_repparameter_column.parameter_table_name is
  3879. 'Name of the table to which the parameter column belongs'
  3880. /
  3881. comment on column all_repparameter_column.parameter_column_name is
  3882. 'Name of the parameter column used for resolving the conflict'
  3883. /
  3884. comment on column all_repparameter_column.parameter_sequence_no is
  3885. 'Ordering on parameter column'
  3886. /
  3887. drop public synonym all_repparameter_column
  3888. /
  3889. create public synonym all_repparameter_column for all_repparameter_column
  3890. /
  3891. grant select on all_repparameter_column to public with grant option
  3892. /
  3893.  
  3894.  
  3895.  
  3896.  
  3897. create or replace view user_repparameter_column
  3898. (
  3899.     oname,
  3900.     conflict_type,
  3901.     reference_name,
  3902.     sequence_no,
  3903.     method_name,
  3904.     function_name,
  3905.     priority_group,
  3906.     parameter_table_name,
  3907.     parameter_column_name,
  3908.     parameter_sequence_no
  3909. )
  3910. as
  3911. select
  3912.     p.oname,
  3913.     decode(p.conflict_type_id,
  3914.            1, 'UPDATE',
  3915.            2, 'UNIQUENESS',
  3916.            3, 'DELETE',
  3917.            'UNDEFINED'),
  3918.     p.reference_name,
  3919.     p.sequence_no,
  3920.     r.method_name,
  3921.     r.function_name,
  3922.     r.priority_group,
  3923.     p.parameter_table_name,
  3924.     p.parameter_column_name,
  3925.     p.parameter_sequence_no
  3926. from  system.repcat$_parameter_column p,
  3927.       system.repcat$_resolution r
  3928. where p.sname = r.sname
  3929. and   p.oname = r.oname
  3930. and   p.conflict_type_id = r.conflict_type_id
  3931. and   p.reference_name = r.reference_name
  3932. and   p.sequence_no = r.sequence_no
  3933. and   p.oname = p.parameter_table_name
  3934. and   p.sname = USER
  3935. /
  3936. comment on table user_repparameter_column is
  3937. 'All columns used for resolving conflicts in user''s replicated tables'
  3938. /
  3939. comment on column user_repparameter_column.oname is
  3940. 'Name of the replicated table'
  3941. /
  3942. comment on column user_repparameter_column.conflict_type is
  3943. 'Type of conflict'
  3944. /
  3945. comment on column user_repparameter_column.reference_name is
  3946. 'Table name, unique constraint name, or column group name'
  3947. /
  3948. comment on column user_repparameter_column.sequence_no is
  3949. 'Ordering on resolution'
  3950. /
  3951. comment on column user_repparameter_column.parameter_table_name is
  3952. 'Name of the table to which the parameter column belongs'
  3953. /
  3954. comment on column user_repparameter_column.parameter_column_name is
  3955. 'Name of the parameter column used for resolving the conflict'
  3956. /
  3957. comment on column user_repparameter_column.parameter_sequence_no is
  3958. 'Ordering on parameter column'
  3959. /
  3960. drop public synonym user_repparameter_column
  3961. /
  3962. create public synonym user_repparameter_column for user_repparameter_column
  3963. /
  3964. grant select on user_repparameter_column to public with grant option
  3965. /
  3966.  
  3967.  
  3968.  
  3969.  
  3970. create table system.repcat$_audit_attribute
  3971. (
  3972.     attribute              varchar2(30)
  3973.                                constraint repcat$_audit_attribute_pk
  3974.                                  primary key,
  3975.     data_type_id           integer
  3976.                                constraint repcat$_audit_attribute_nn1
  3977.                                  not null,
  3978.     data_length            integer,
  3979.     source                 varchar2(92)
  3980.                                constraint repcat$_audit_attribute_nn2
  3981.                                  not null,
  3982.         constraint repcat$_audit_attribute_c1
  3983.           check ((data_type_id in (2, 4, 5) and
  3984.                   data_length is not null)
  3985.               or (data_type_id not in (2, 4, 5) and
  3986.                   data_length is null))
  3987. )
  3988. /
  3989. comment on table system.repcat$_audit_attribute is
  3990. 'Information about attributes automatically maintained for replication'
  3991. /
  3992. comment on column system.repcat$_audit_attribute.attribute is
  3993. 'Description of the attribute'
  3994. /
  3995. comment on column system.repcat$_audit_attribute.data_type_id is
  3996. 'Datatype of the attribute value'
  3997. /
  3998. comment on column system.repcat$_audit_attribute.data_length is
  3999. 'Length of the attribute value in byte'
  4000. /
  4001. comment on column system.repcat$_audit_attribute.source is
  4002. 'Name of the function which returns the attribute value'
  4003. /
  4004.  
  4005.  
  4006.  
  4007.  
  4008. create or replace view dba_repaudit_attribute
  4009. (
  4010.     attribute,
  4011.     data_type,
  4012.     data_length,
  4013.     source
  4014. )
  4015. as
  4016. select
  4017.     attribute,
  4018.     decode(data_type_id,
  4019.            1, 'NUMBER',
  4020.            2, 'VARCHAR2',
  4021.            3, 'DATE',
  4022.            4, 'CHAR',
  4023.            5, 'RAW',
  4024.            'UNDEFINED'),
  4025.     data_length,
  4026.     source
  4027. from  system.repcat$_audit_attribute
  4028. /
  4029. comment on table dba_repaudit_attribute is
  4030. 'Information about attributes automatically maintained for replication'
  4031. /
  4032. comment on column dba_repaudit_attribute.attribute is
  4033. 'Description of the attribute'
  4034. /
  4035. comment on column dba_repaudit_attribute.data_type is
  4036. 'Datatype of the attribute value'
  4037. /
  4038. comment on column dba_repaudit_attribute.data_length is
  4039. 'Length of the attribute value in byte'
  4040. /
  4041. comment on column dba_repaudit_attribute.source is
  4042. 'Name of the function which returns the attribute value'
  4043. /
  4044.  
  4045.  
  4046.  
  4047.  
  4048. create or replace view all_repaudit_attribute
  4049. (
  4050.     attribute,
  4051.     data_type,
  4052.     data_length,
  4053.     source
  4054. )
  4055. as
  4056. select
  4057.     attribute,
  4058.     decode(data_type_id,
  4059.            1, 'NUMBER',
  4060.            2, 'VARCHAR2',
  4061.            3, 'DATE',
  4062.            4, 'CHAR',
  4063.            5, 'RAW',
  4064.            'UNDEFINED'),
  4065.     data_length,
  4066.     source
  4067. from  system.repcat$_audit_attribute
  4068. /
  4069. comment on table all_repaudit_attribute is
  4070. 'Information about attributes automatically maintained for replication'
  4071. /
  4072. comment on column all_repaudit_attribute.attribute is
  4073. 'Description of the attribute'
  4074. /
  4075. comment on column all_repaudit_attribute.data_type is
  4076. 'Datatype of the attribute value'
  4077. /
  4078. comment on column all_repaudit_attribute.data_length is
  4079. 'Length of the attribute value in byte'
  4080. /
  4081. comment on column all_repaudit_attribute.source is
  4082. 'Name of the function which returns the attribute value'
  4083. /
  4084. drop public synonym all_repaudit_attribute
  4085. /
  4086. create public synonym all_repaudit_attribute for all_repaudit_attribute
  4087. /
  4088. grant select on all_repaudit_attribute to public with grant option
  4089. /
  4090.  
  4091.  
  4092.  
  4093.  
  4094. create or replace view user_repaudit_attribute
  4095. (
  4096.     attribute,
  4097.     data_type,
  4098.     data_length,
  4099.     source
  4100. )
  4101. as
  4102. select
  4103.     attribute,
  4104.     decode(data_type_id,
  4105.            1, 'NUMBER',
  4106.            2, 'VARCHAR2',
  4107.            3, 'DATE',
  4108.            4, 'CHAR',
  4109.            5, 'RAW',
  4110.            'UNDEFINED'),
  4111.     data_length,
  4112.     source
  4113. from  system.repcat$_audit_attribute
  4114. /
  4115. comment on table user_repaudit_attribute is
  4116. 'Information about attributes automatically maintained for replication'
  4117. /
  4118. comment on column user_repaudit_attribute.attribute is
  4119. 'Description of the attribute'
  4120. /
  4121. comment on column user_repaudit_attribute.data_type is
  4122. 'Datatype of the attribute value'
  4123. /
  4124. comment on column user_repaudit_attribute.data_length is
  4125. 'Length of the attribute value in byte'
  4126. /
  4127. comment on column user_repaudit_attribute.source is
  4128. 'Name of the function which returns the attribute value'
  4129. /
  4130. drop public synonym user_repaudit_attribute
  4131. /
  4132. create public synonym user_repaudit_attribute for user_repaudit_attribute
  4133. /
  4134. grant select on user_repaudit_attribute to public with grant option
  4135. /
  4136.  
  4137.  
  4138.  
  4139.  
  4140. create table system.repcat$_audit_column
  4141. (
  4142.     sname                  varchar2(30),
  4143.     oname                  varchar2(30),
  4144.     column_name            varchar2(30),
  4145.     base_sname             varchar2(30)
  4146.                                constraint repcat$_audit_column_nn1
  4147.                                  not null,
  4148.     base_oname             varchar2(30)
  4149.                                constraint repcat$_audit_column_nn2
  4150.                                  not null,
  4151.     base_conflict_type_id  integer
  4152.                                constraint repcat$_audit_column_nn3
  4153.                                  not null,
  4154.     base_reference_name    varchar2(30)
  4155.                                constraint repcat$_audit_column_nn4
  4156.                                  not null,
  4157.     attribute              varchar2(30)
  4158.                                constraint repcat$_audit_column_nn5
  4159.                                  not null
  4160.                                constraint repcat$_audit_column_f1
  4161.                                  references system.repcat$_audit_attribute,
  4162.         constraint repcat$_audit_column_pk
  4163.           primary key (column_name, oname, sname),
  4164.         constraint repcat$_audit_column_f2
  4165.           foreign key (base_sname,
  4166.                        base_oname,
  4167.                        base_conflict_type_id,
  4168.                        base_reference_name)
  4169.           references system.repcat$_conflict
  4170. )
  4171. /
  4172. comment on table system.repcat$_audit_column is
  4173. 'Information about columns in all shadow tables for all replicated tables in the database'
  4174. /
  4175. comment on column system.repcat$_audit_column.sname is
  4176. 'Owner of the shadow table'
  4177. /
  4178. comment on column system.repcat$_audit_column.oname is
  4179. 'Name of the shadow table'
  4180. /
  4181. comment on column system.repcat$_audit_column.column_name is
  4182. 'Name of the column in the shadow table'
  4183. /
  4184. comment on column system.repcat$_audit_column.base_sname is
  4185. 'Name of the replicated schema'
  4186. /
  4187. comment on column system.repcat$_audit_column.base_oname is
  4188. 'Name of the replicated table'
  4189. /
  4190. comment on column system.repcat$_audit_column.base_conflict_type_id is
  4191. 'Type of conflict'
  4192. /
  4193. comment on column system.repcat$_audit_column.base_reference_name is
  4194. 'Table name, unique constraint name, or column group name'
  4195. /
  4196. comment on column system.repcat$_audit_column.attribute is
  4197. 'Description of the attribute'
  4198. /
  4199.  
  4200.  
  4201.  
  4202.  
  4203. create or replace view dba_repaudit_column
  4204. (
  4205.     sname,
  4206.     oname,
  4207.     column_name,
  4208.     base_sname,
  4209.     base_oname,
  4210.     base_conflict_type,
  4211.     base_reference_name,
  4212.     attribute
  4213. )
  4214. as
  4215. select
  4216.     sname,
  4217.     oname,
  4218.     column_name,
  4219.     base_sname,
  4220.     base_oname,
  4221.     decode(base_conflict_type_id,
  4222.            1, 'UPDATE',
  4223.            2, 'UNIQUENESS',
  4224.            3, 'DELETE',
  4225.            'UNDEFINED'),
  4226.     base_reference_name,
  4227.     attribute
  4228. from  system.repcat$_audit_column
  4229. /
  4230. comment on table dba_repaudit_column is
  4231. 'Information about columns in all shadow tables for all replicated tables in the database'
  4232. /
  4233. comment on column dba_repaudit_column.sname is
  4234. 'Owner of the shadow table'
  4235. /
  4236. comment on column dba_repaudit_column.oname is
  4237. 'Name of the shadow table'
  4238. /
  4239. comment on column dba_repaudit_column.column_name is
  4240. 'Name of the column in the shadow table'
  4241. /
  4242. comment on column dba_repaudit_column.base_sname is
  4243. 'Name of the replicated schema'
  4244. /
  4245. comment on column dba_repaudit_column.base_oname is
  4246. 'Name of the replicated table'
  4247. /
  4248. comment on column dba_repaudit_column.base_conflict_type is
  4249. 'Type of conflict'
  4250. /
  4251. comment on column dba_repaudit_column.base_reference_name is
  4252. 'Table name, unique constraint name, or column group name'
  4253. /
  4254. comment on column dba_repaudit_column.attribute is
  4255. 'Description of the attribute'
  4256. /
  4257.  
  4258.  
  4259.  
  4260.  
  4261. create or replace view all_repaudit_column
  4262. (
  4263.     sname,
  4264.     oname,
  4265.     column_name,
  4266.     base_sname,
  4267.     base_oname,
  4268.     base_conflict_type,
  4269.     base_reference_name,
  4270.     attribute
  4271. )
  4272. as
  4273. select
  4274.     sname,
  4275.     oname,
  4276.     column_name,
  4277.     base_sname,
  4278.     base_oname,
  4279.     decode(base_conflict_type_id,
  4280.            1, 'UPDATE',
  4281.            2, 'UNIQUENESS',
  4282.            3, 'DELETE',
  4283.            'UNDEFINED'),
  4284.     base_reference_name,
  4285.     attribute
  4286. from  system.repcat$_audit_column,
  4287.      sys.user$ u, sys.obj$ o
  4288. where sname = u.name
  4289.   and oname = o.name
  4290.   and o.owner# = u.user#
  4291.   and o.type = 2 /* tables */
  4292.   and (o.owner# = userenv('SCHEMAID')
  4293.         or
  4294.        o.obj# in ( select obj#
  4295.                    from objauth$
  4296.                    where grantee# in ( select kzsrorol
  4297.                                        from x$kzsro
  4298.                                      )
  4299.                   )
  4300.         or
  4301.      exists (select null from v$enabledprivs
  4302.              where priv_number in (-45 /* LOCK ANY TABLE */,
  4303.                        -47 /* SELECT ANY TABLE */,
  4304.                        -48 /* INSERT ANY TABLE */,
  4305.                        -49 /* UPDATE ANY TABLE */,
  4306.                        -50 /* DELETE ANY TABLE */)
  4307.                  )
  4308.        )
  4309. /
  4310. comment on table all_repaudit_column is
  4311. 'Information about columns in all shadow tables for replicated tables which are accessible to the user'
  4312. /
  4313. comment on column all_repaudit_column.sname is
  4314. 'Owner of the shadow table'
  4315. /
  4316. comment on column all_repaudit_column.oname is
  4317. 'Name of the shadow table'
  4318. /
  4319. comment on column all_repaudit_column.column_name is
  4320. 'Name of the column in the shadow table'
  4321. /
  4322. comment on column all_repaudit_column.base_sname is
  4323. 'Name of the replicated schema'
  4324. /
  4325. comment on column all_repaudit_column.base_oname is
  4326. 'Name of the replicated table'
  4327. /
  4328. comment on column all_repaudit_column.base_conflict_type is
  4329. 'Type of conflict'
  4330. /
  4331. comment on column all_repaudit_column.base_reference_name is
  4332. 'Table name, unique constraint name, or column group name'
  4333. /
  4334. comment on column all_repaudit_column.attribute is
  4335. 'Description of the attribute'
  4336. /
  4337. drop public synonym all_repaudit_column
  4338. /
  4339. create public synonym all_repaudit_column for all_repaudit_column
  4340. /
  4341. grant select on all_repaudit_column to public with grant option
  4342. /
  4343.  
  4344.  
  4345.  
  4346.  
  4347. create or replace view user_repaudit_column
  4348. (
  4349.     oname,
  4350.     column_name,
  4351.     base_sname,
  4352.     base_oname,
  4353.     base_conflict_type,
  4354.     base_reference_name,
  4355.     attribute
  4356. )
  4357. as
  4358. select
  4359.     oname,
  4360.     column_name,
  4361.     base_sname,
  4362.     base_oname,
  4363.     decode(base_conflict_type_id,
  4364.            1, 'UPDATE',
  4365.            2, 'UNIQUENESS',
  4366.            3, 'DELETE',
  4367.            'UNDEFINED'),
  4368.     base_reference_name,
  4369.     attribute
  4370. from  system.repcat$_audit_column
  4371. where sname = USER
  4372. /
  4373. comment on table user_repaudit_column is
  4374. 'Information about columns in all shadow tables for user''s replicated tables'
  4375. /
  4376. comment on column user_repaudit_column.oname is
  4377. 'Name of the shadow table'
  4378. /
  4379. comment on column user_repaudit_column.column_name is
  4380. 'Name of the column in the shadow table'
  4381. /
  4382. comment on column user_repaudit_column.base_sname is
  4383. 'Name of the replicated schema'
  4384. /
  4385. comment on column user_repaudit_column.base_oname is
  4386. 'Name of the replicated table'
  4387. /
  4388. comment on column user_repaudit_column.base_conflict_type is
  4389. 'Type of conflict'
  4390. /
  4391. comment on column user_repaudit_column.base_reference_name is
  4392. 'Table name, unique constraint name, or column group name'
  4393. /
  4394. comment on column user_repaudit_column.attribute is
  4395. 'Description of the attribute'
  4396. /
  4397. drop public synonym user_repaudit_column
  4398. /
  4399. create public synonym user_repaudit_column for user_repaudit_column
  4400. /
  4401. grant select on user_repaudit_column to public with grant option
  4402. /
  4403.  
  4404.  
  4405.  
  4406.  
  4407. --
  4408. -- Supported audit attributes.
  4409. --
  4410. delete from system.repcat$_audit_attribute
  4411. /
  4412. insert into system.repcat$_audit_attribute
  4413.   (attribute, data_type_id, data_length, source)
  4414.   values
  4415.   ('TIMESTAMP', 3, NULL, 'SYSDATE')
  4416. /
  4417. insert into system.repcat$_audit_attribute
  4418.   (attribute, data_type_id, data_length, source)
  4419.   values
  4420.   ('GLOBAL NAME', 2, 128, 'DBMS_REPUTIL.GLOBAL_NAME')
  4421. /
  4422.  
  4423. --
  4424. -- Supported automatic conflict resolution methods.
  4425. --
  4426. -- UPDATE METHODS:
  4427. -- 'MINIMUM', 'EARLIEST TIMESTAMP', 'MAXIMUM', 'LATEST TIMESTAMP',
  4428. -- 'SITE PRIORITY', 'PRIORITY GROUP', 'ADDITIVE', 'AVERAGE',
  4429. -- 'OVERWRITE', 'DISCARD', 'USER FUNCTION',
  4430. delete from system.repcat$_resolution_method
  4431.   where conflict_type_id = 1
  4432. /
  4433. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4434.   values (1, 'MINIMUM')
  4435. /
  4436. insert into system.repcat$_resolution_method (conflict_type_id, method_name) 
  4437.   values (1, 'EARLIEST TIMESTAMP' )
  4438. /
  4439. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4440.   values (1, 'MAXIMUM')
  4441. /
  4442. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4443.   values (1, 'LATEST TIMESTAMP')
  4444. /
  4445. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4446.   values (1, 'SITE PRIORITY')
  4447. /
  4448. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4449.   values (1, 'PRIORITY GROUP')
  4450. /
  4451. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4452.   values (1, 'ADDITIVE')
  4453. /
  4454. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4455.   values (1, 'AVERAGE')
  4456. /
  4457. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4458.   values (1, 'OVERWRITE')
  4459. /
  4460. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4461.   values (1, 'DISCARD')
  4462. /
  4463. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4464.   values (1, 'USER FUNCTION')
  4465. /
  4466.  
  4467. -- INSERT METHODS:
  4468. -- 'APPEND SITE NAME', 'APPEND SEQUENCE', 'DISCARD', 'USER FUNCTION'
  4469. delete from system.repcat$_resolution_method
  4470.   where conflict_type_id = 2
  4471. /
  4472. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4473.   values (2, 'APPEND SITE NAME')
  4474. /
  4475. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4476.   values (2, 'APPEND SEQUENCE')
  4477. /
  4478. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4479.   values (2, 'DISCARD')
  4480. /
  4481. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4482.   values (2, 'USER FUNCTION')
  4483. /
  4484.  
  4485. -- DELETE METHODS:
  4486. -- 'USER FUNCTION',
  4487. delete from system.repcat$_resolution_method
  4488.   where conflict_type_id = 3
  4489. /
  4490. insert into system.repcat$_resolution_method (conflict_type_id, method_name)
  4491.   values (3, 'USER FUNCTION')
  4492. /
  4493.  
  4494. commit
  4495.  
  4496. Rem  ************************************************************
  4497. Rem replacement of deferred rpc view to include joins repcat tables
  4498. Rem replace defcalldest view to include repcat query
  4499. drop view defcalldest;
  4500. create view defcalldest as
  4501.   select C1.callno, C.deferred_tran_id, C.deferred_tran_db, D.dblink
  4502.     from system.def$_call C, system.def$_call C1, system.def$_destination D 
  4503.     where C.destination_list IS NOT NULL
  4504.       and C.buffer_number = 1
  4505.       and C1.buffer_number = 1
  4506.       and C1.deferred_tran_db = c.deferred_tran_db
  4507.       and C1.deferred_tran_id = c.deferred_tran_id
  4508.       and ((  C.destination_list = 'D' 
  4509.             AND EXISTS (
  4510.               select NULL 
  4511.                 from system.def$_calldest CD
  4512.                 where  CD.deferred_tran_id=C1.deferred_tran_id
  4513.                   AND  CD.deferred_tran_db=C1.deferred_tran_db
  4514.                   AND  CD.callno=C1.callno
  4515.                   AND  CD.dblink = D.dblink ))
  4516.           OR ( C.destination_list='R' 
  4517.               AND (C.delivery_order > D.last_delivered
  4518.                    OR
  4519.                    (C.delivery_order = D.last_delivered 
  4520.                     AND (C.deferred_tran_id > D.last_tran_id
  4521.                          OR (C.deferred_tran_id = D.last_tran_id
  4522.                              AND C.deferred_tran_db > D.last_tran_db))))
  4523.               AND EXISTS (
  4524.               SELECT NULL  
  4525.                 from  system.repcat$_repschema R
  4526.                 WHERE  D.dblink = R.dblink
  4527.                   AND  R.sname =  C1.schemaname 
  4528.                   AND (  (master = 'N' AND  snapmaster = 'Y')
  4529.                        OR (master = 'Y' AND my_dblink = 'N'))
  4530.                   AND ( R.prop_updates = 0 
  4531.                        OR EXISTS (
  4532.                          SELECT NULL
  4533.                               FROM system.repcat$_repprop P 
  4534.                              WHERE P.sname = C.schemaname
  4535.                                AND P.dblink = R.dblink
  4536.                                AND P.how = 1 
  4537.                                AND ( ( P.oname = C.packagename 
  4538.                                        AND P.type = 9) 
  4539.                                       OR ( P.oname = C.procname 
  4540.                                            AND P.type = 7 )))))))
  4541. /
  4542. drop view deftrandest;
  4543. create view deftrandest as
  4544.   select C.deferred_tran_id, C.deferred_tran_db, D.dblink
  4545.     from system.def$_call C, system.def$_destination D 
  4546.     where C.destination_list IS NOT NULL
  4547.       and C.buffer_number = 1
  4548.       AND (C.delivery_order > D.last_delivered
  4549.            OR
  4550.            (C.delivery_order = D.last_delivered 
  4551.             AND (C.deferred_tran_id > D.last_tran_id
  4552.                  OR (C.deferred_tran_id = D.last_tran_id
  4553.                      AND C.deferred_tran_db > D.last_tran_db))))
  4554.       and ((  C.destination_list = 'D' 
  4555.             AND EXISTS (
  4556.               select NULL 
  4557.                 from system.def$_calldest CD
  4558.                 where  CD.deferred_tran_id=C.deferred_tran_id
  4559.                   AND  CD.deferred_tran_db=C.deferred_tran_db
  4560.                   AND  CD.dblink = D.dblink )
  4561.             AND NOT EXISTS (
  4562.               select NULL 
  4563.                 from system.def$_error E
  4564.                 where  E.deferred_tran_id=C.deferred_tran_id
  4565.                   AND  E.deferred_tran_db=C.deferred_tran_db
  4566.                   AND  E.destination = D.dblink )
  4567.              )
  4568.           OR ( C.destination_list='R' 
  4569.             AND EXISTS (
  4570.               SELECT NULL  
  4571.                 from system.def$_call C2, system.repcat$_repschema R
  4572.                 WHERE  C2.deferred_tran_id=C.deferred_tran_id
  4573.                   AND  C2.deferred_tran_db=C.deferred_tran_db
  4574.                   AND  C2.buffer_number = 1
  4575.                   AND  D.dblink = R.dblink
  4576.                   AND  R.sname =  C2.schemaname 
  4577.                   AND (  (master = 'N' AND  snapmaster = 'Y')
  4578.                        OR (master = 'Y' AND my_dblink = 'N'))
  4579.                   AND ( R.prop_updates = 0 
  4580.                        OR EXISTS (
  4581.                          SELECT NULL
  4582.                               FROM system.repcat$_repprop P 
  4583.                              WHERE P.sname = C.schemaname
  4584.                                AND P.dblink = R.dblink
  4585.                                AND P.how = 1 
  4586.                                AND ( ( P.oname = C.packagename 
  4587.                                        AND P.type = 9) 
  4588.                                       OR ( P.oname = C.procname 
  4589.                                            AND P.type = 7 )))))))
  4590. /
  4591. Rem **********************************************************************
  4592. Rem For SYS to be able to grant select on defcalldest and deftrandest
  4593. Rem it need to be explictly
  4594. Rem granted priviledges on the underlying SYSTEM onwed tables.
  4595. Rem To get those priviledges, SYS creates and executes a package owned 
  4596. Rem by SYSTEM that issues the grants to SYS using DBMS_SQL.
  4597. create or replace procedure system.ora$_sys_rep_auth as
  4598. i integer;
  4599. x integer;
  4600. begin
  4601.   i:=dbms_sql.open_cursor;
  4602.   dbms_sql.parse(i,'GRANT SELECT ON SYSTEM.repcat$_repschema TO SYS ' ||
  4603.                  'WITH GRANT OPTION',dbms_sql.v7);
  4604.   x:=dbms_sql.execute(i);
  4605.   dbms_sql.parse(i,'GRANT SELECT ON SYSTEM.repcat$_repprop TO SYS ' ||
  4606.                  'WITH GRANT OPTION',dbms_sql.v7);
  4607.   x:=dbms_sql.execute(i);
  4608.   dbms_sql.parse(i,'GRANT SELECT ON SYSTEM.def$_call TO SYS ' ||
  4609.                  'WITH GRANT OPTION',dbms_sql.v7);
  4610.   x:=dbms_sql.execute(i);
  4611.   dbms_sql.parse(i,'GRANT SELECT ON SYSTEM.def$_calldest TO SYS ' ||
  4612.                  'WITH GRANT OPTION',dbms_sql.v7);
  4613.   x:=dbms_sql.execute(i);
  4614.   dbms_sql.parse(i,'GRANT SELECT ON SYSTEM.def$_error TO SYS ' ||
  4615.                  'WITH GRANT OPTION',dbms_sql.v7);
  4616.   x:=dbms_sql.execute(i);
  4617.   dbms_sql.parse(i,'GRANT SELECT ON SYSTEM.def$_destination TO SYS ' ||
  4618.                  'WITH GRANT OPTION',dbms_sql.v7);
  4619.   x:=dbms_sql.execute(i);
  4620. end;
  4621. /
  4622.  
  4623. begin
  4624.  system.ora$_sys_rep_auth;
  4625. end;  
  4626. /
  4627.